fraim-framework 1.0.12 → 2.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.
Files changed (93) hide show
  1. package/.ai-agents/agent-guardrails.md +58 -0
  2. package/.ai-agents/mcp-template.jsonc +34 -0
  3. package/.ai-agents/rules/agent-testing-guidelines.md +545 -0
  4. package/.ai-agents/rules/architecture.md +52 -0
  5. package/.ai-agents/rules/communication.md +122 -0
  6. package/.ai-agents/rules/continuous-learning.md +55 -0
  7. package/.ai-agents/rules/git-safe-commands.md +34 -0
  8. package/.ai-agents/rules/integrity-and-test-ethics.md +223 -0
  9. package/.ai-agents/rules/local-development.md +252 -0
  10. package/.ai-agents/rules/merge-requirements.md +231 -0
  11. package/.ai-agents/rules/pr-workflow-completeness.md +191 -0
  12. package/.ai-agents/rules/simplicity.md +112 -0
  13. package/.ai-agents/rules/software-development-lifecycle.md +276 -0
  14. package/.ai-agents/rules/spike-first-development.md +199 -0
  15. package/.ai-agents/rules/successful-debugging-patterns.md +313 -0
  16. package/.ai-agents/scripts/cleanup-branch.ts +278 -0
  17. package/.ai-agents/scripts/exec-with-timeout.ts +122 -0
  18. package/.ai-agents/scripts/prep-issue.sh +162 -0
  19. package/.ai-agents/templates/evidence/Design-Evidence.md +30 -0
  20. package/.ai-agents/templates/evidence/Implementation-BugEvidence.md +48 -0
  21. package/.ai-agents/templates/evidence/Implementation-FeatureEvidence.md +54 -0
  22. package/.ai-agents/templates/evidence/Spec-Evidence.md +19 -0
  23. package/.ai-agents/templates/help/HelpNeeded.md +14 -0
  24. package/.ai-agents/templates/retrospective/RETROSPECTIVE-TEMPLATE.md +55 -0
  25. package/.ai-agents/templates/specs/BUGSPEC-TEMPLATE.md +37 -0
  26. package/.ai-agents/templates/specs/FEATURESPEC-TEMPLATE.md +29 -0
  27. package/.ai-agents/templates/specs/TECHSPEC-TEMPLATE.md +39 -0
  28. package/.ai-agents/workflows/design.md +121 -0
  29. package/.ai-agents/workflows/implement.md +170 -0
  30. package/.ai-agents/workflows/resolve.md +152 -0
  31. package/.ai-agents/workflows/retrospect.md +84 -0
  32. package/.ai-agents/workflows/spec.md +103 -0
  33. package/.ai-agents/workflows/test.md +90 -0
  34. package/.cursor/rules/cursor-rules.mdc +8 -0
  35. package/.cursor/rules/design.mdc +4 -0
  36. package/.cursor/rules/implement.mdc +6 -0
  37. package/.cursor/rules/resolve.mdc +5 -0
  38. package/.cursor/rules/retrospect.mdc +4 -0
  39. package/.cursor/rules/spec.mdc +4 -0
  40. package/.cursor/rules/test.mdc +5 -0
  41. package/.windsurf/rules/windsurf-rules.md +7 -0
  42. package/.windsurf/workflows/resolve-issue.md +6 -0
  43. package/.windsurf/workflows/retrospect.md +6 -0
  44. package/.windsurf/workflows/start-design.md +6 -0
  45. package/.windsurf/workflows/start-impl.md +6 -0
  46. package/.windsurf/workflows/start-spec.md +6 -0
  47. package/.windsurf/workflows/start-tests.md +6 -0
  48. package/CHANGELOG.md +66 -0
  49. package/CODEOWNERS +24 -0
  50. package/DISTRIBUTION.md +6 -6
  51. package/PUBLISH_INSTRUCTIONS.md +93 -0
  52. package/README.md +330 -104
  53. package/bin/fraim.js +49 -3
  54. package/index.js +30 -3
  55. package/install.sh +58 -58
  56. package/labels.json +52 -0
  57. package/linkedin-post.md +23 -0
  58. package/package.json +12 -7
  59. package/sample_package.json +18 -0
  60. package/setup.js +733 -384
  61. package/test-utils.ts +118 -0
  62. package/tsconfig.json +22 -0
  63. package/agents/claude/CLAUDE.md +0 -42
  64. package/agents/cursor/rules/architecture.mdc +0 -49
  65. package/agents/cursor/rules/continuous-learning.mdc +0 -48
  66. package/agents/cursor/rules/cursor-workflow.mdc +0 -29
  67. package/agents/cursor/rules/design.mdc +0 -25
  68. package/agents/cursor/rules/implement.mdc +0 -26
  69. package/agents/cursor/rules/local-development.mdc +0 -104
  70. package/agents/cursor/rules/prep.mdc +0 -15
  71. package/agents/cursor/rules/resolve.mdc +0 -46
  72. package/agents/cursor/rules/simplicity.mdc +0 -18
  73. package/agents/cursor/rules/software-development-lifecycle.mdc +0 -41
  74. package/agents/cursor/rules/test.mdc +0 -25
  75. package/agents/windsurf/rules/architecture.md +0 -49
  76. package/agents/windsurf/rules/continuous-learning.md +0 -47
  77. package/agents/windsurf/rules/local-development.md +0 -103
  78. package/agents/windsurf/rules/remote-development.md +0 -22
  79. package/agents/windsurf/rules/simplicity.md +0 -17
  80. package/agents/windsurf/rules/windsurf-workflow.md +0 -28
  81. package/agents/windsurf/workflows/prep.md +0 -20
  82. package/agents/windsurf/workflows/resolve-issue.md +0 -47
  83. package/agents/windsurf/workflows/start-design.md +0 -26
  84. package/agents/windsurf/workflows/start-impl.md +0 -27
  85. package/agents/windsurf/workflows/start-tests.md +0 -26
  86. package/github/phase-change.yml +0 -218
  87. package/github/status-change.yml +0 -68
  88. package/github/sync-on-pr-review.yml +0 -66
  89. package/scripts/__init__.py +0 -10
  90. package/scripts/cli.py +0 -141
  91. package/setup.py +0 -0
  92. package/test-config.json +0 -32
  93. package/workflows/setup-fraim.yml +0 -147
package/setup.js CHANGED
@@ -1,482 +1,831 @@
1
1
  #!/usr/bin/env node
2
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
+
3
11
  const fs = require('fs');
4
12
  const path = require('path');
5
13
  const { execSync } = require('child_process');
6
14
  const readline = require('readline');
7
15
 
8
- // Colors for console output
16
+ // ANSI color codes for terminal output
9
17
  const colors = {
10
18
  reset: '\x1b[0m',
11
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',
12
27
  red: '\x1b[31m',
13
28
  green: '\x1b[32m',
14
29
  yellow: '\x1b[33m',
15
30
  blue: '\x1b[34m',
16
31
  magenta: '\x1b[35m',
17
- cyan: '\x1b[36m'
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'
18
43
  };
19
44
 
20
- function log(message, color = 'reset') {
21
- console.log(`${colors[color]}${message}${colors.reset}`);
45
+ // Logging functions
46
+ function log(message) {
47
+ console.log(message);
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);
22
58
  }
23
59
 
24
60
  function logSuccess(message) {
25
- log(`āœ… ${message}`, 'green');
61
+ console.log(colors.green + 'āœ“ ' + message + colors.reset);
26
62
  }
27
63
 
28
64
  function logInfo(message) {
29
- log(`ā„¹ļø ${message}`, 'blue');
65
+ console.log(colors.cyan + 'ℹ ' + message + colors.reset);
30
66
  }
31
67
 
32
68
  function logWarning(message) {
33
- log(`āš ļø ${message}`, 'yellow');
69
+ console.log(colors.yellow + '⚠ ' + message + colors.reset);
34
70
  }
35
71
 
36
72
  function logError(message) {
37
- log(`āŒ ${message}`, 'red');
38
- }
39
-
40
- function logHeader(message) {
41
- log(`\n${colors.bright}${colors.cyan}${message}${colors.reset}`);
42
- log('─'.repeat(message.length));
73
+ console.error(colors.red + 'āœ— ' + message + colors.reset);
43
74
  }
44
75
 
45
- function logStep(message) {
46
- log(`\n${colors.bright}${colors.magenta}${message}${colors.reset}`);
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;
47
84
  }
48
85
 
49
- function ensureDirectory(dirPath) {
50
- if (!fs.existsSync(dirPath)) {
51
- fs.mkdirSync(dirPath, { recursive: true });
52
- logSuccess(`Created directory: ${dirPath}`);
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 });
53
92
  }
93
+
94
+ fs.writeFileSync(fullPath, content);
54
95
  }
55
96
 
56
- function writeFile(filePath, content) {
57
- ensureDirectory(path.dirname(filePath));
58
- fs.writeFileSync(filePath, content);
59
- logSuccess(`Created file: ${filePath}`);
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;
60
112
  }
61
113
 
62
114
  function copyDirectory(src, dest) {
63
- if (!fs.existsSync(dest)) {
64
- fs.mkdirSync(dest, { recursive: true });
115
+ const srcPath = path.resolve(process.cwd(), src);
116
+ const destPath = path.resolve(process.cwd(), dest);
117
+
118
+ if (!fs.existsSync(srcPath)) {
119
+ return false;
65
120
  }
66
121
 
67
- const items = fs.readdirSync(src);
68
- for (const item of items) {
69
- const srcPath = path.join(src, item);
70
- const destPath = path.join(dest, item);
122
+ if (!fs.existsSync(destPath)) {
123
+ fs.mkdirSync(destPath, { recursive: true });
124
+ }
125
+
126
+ const files = fs.readdirSync(srcPath);
127
+
128
+ for (const file of files) {
129
+ const srcFile = path.join(srcPath, file);
130
+ const destFile = path.join(destPath, file);
71
131
 
72
- if (fs.statSync(srcPath).isDirectory()) {
73
- copyDirectory(srcPath, destPath);
132
+ if (fs.statSync(srcFile).isDirectory()) {
133
+ copyDirectory(srcFile, destFile);
74
134
  } else {
75
- fs.copyFileSync(srcPath, destPath);
76
- logSuccess(`Copied: ${destPath}`);
135
+ fs.copyFileSync(srcFile, destFile);
77
136
  }
78
137
  }
138
+
139
+ return true;
79
140
  }
80
141
 
81
- function askQuestion(question, defaultValue = 'y') {
82
- return new Promise((resolve) => {
83
- const rl = readline.createInterface({
84
- input: process.stdin,
85
- output: process.stdout
86
- });
87
-
88
- const defaultText = defaultValue ? ` (${defaultValue})` : '';
89
- rl.question(`${question}${defaultText}: `, (answer) => {
142
+ function isGitRepository() {
143
+ try {
144
+ execSync('git rev-parse --is-inside-work-tree', { stdio: 'ignore' });
145
+ return true;
146
+ } catch (e) {
147
+ return false;
148
+ }
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
+
162
+ return new Promise(resolve => {
163
+ rl.question(colors.yellow + '? ' + question + ' (y/n) ' + colors.reset, answer => {
90
164
  rl.close();
91
- const finalAnswer = answer.trim() || defaultValue;
92
- resolve(finalAnswer.toLowerCase());
165
+ resolve(answer.toLowerCase());
93
166
  });
94
167
  });
95
168
  }
96
169
 
97
- function createProjectStructure() {
98
- // Create retrospectives folder
99
- ensureDirectory('retrospectives');
100
- logSuccess('Created retrospectives folder');
101
-
102
- // Create docs/rfcs folder
103
- ensureDirectory('docs/rfcs');
104
- logSuccess('Created docs/rfcs folder');
170
+ async function askInput(question, defaultValue = '') {
171
+ const rl = createReadlineInterface();
105
172
 
106
- // Create BUGFIX template
107
- const bugfixTemplate = `Issue: #<issue>
173
+ return new Promise(resolve => {
174
+ rl.question(colors.yellow + '? ' + question + (defaultValue ? ` (${defaultValue})` : '') + ': ' + colors.reset, answer => {
175
+ rl.close();
176
+ resolve(answer || defaultValue);
177
+ });
178
+ });
179
+ }
108
180
 
109
- ## Impact of the Bug
181
+ // Create rule files
182
+ function createRuleFiles() {
183
+ // Create integrity-and-test-ethics.md
184
+ const integrityContent = `# Integrity and Test Ethics
110
185
 
111
- ## Repro Steps
186
+ THIS IS THE MOST CRITICAL RULE. Be ethical, truthful, honest above all.
112
187
 
113
- ## Root Cause
188
+ ## Core Principles
114
189
 
115
- ## Fix
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.
116
195
 
117
- ## Tests
118
- - Could be existing tests that are failing and need to be fixed
119
- - Could be new tests that need to be added into an existing test suite
120
- - Could be a new test suite
121
- `;
122
- writeFile('docs/rfcs/BUGFIX-TEMPLATE.md', bugfixTemplate);
123
- logSuccess('Created BUGFIX-TEMPLATE.md');
124
-
125
- // Create RFC template
126
- const rfcTemplate = `# RFC: <Title>
196
+ ## Test Ethics Guidelines
127
197
 
128
- Issue: #<issue>
129
- Owner: <agent>
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
130
203
 
131
- ## Customer
204
+ ## Implementation Ethics
132
205
 
133
- ## Customer Outcome
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('rules/integrity-and-test-ethics.md', integrityContent);
212
+ logSuccess('Created integrity-and-test-ethics.md');
134
213
 
135
- ## Customer Problem being solved
214
+ // Create simplicity.md
215
+ const simplicityContent = `# Simplicity
136
216
 
137
- ## Solution
217
+ Keep solutions simple and focused, avoid over-engineering.
138
218
 
139
- ## Alternatives
219
+ ## Core Principles
140
220
 
141
- ## Design Details
142
- - User Experience changes (incl. all modalities currently supported: see codebase to know which ones)
143
- - API surface (OpenAPI) changes
144
- - Data model / schema changes
145
- - Failure modes & timeouts
146
- - Telemetry & analytics
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.
147
226
 
148
- ## Test Matrix
149
- - Unit: modules & edge cases
150
- - Integration: API <-> DB <-> external
151
- - E2E: user flows (happy/sad)
227
+ ## Guidelines
152
228
 
153
- ## Risks & Mitigations
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
154
234
 
155
- ## Observability (logs, metrics, alerts)
235
+ ## When Fixing Issues
156
236
 
157
- ## Phased Delivery Plan
158
- - Do not incude timelines
159
- - Do include the following for each phase:
160
- - Deliverable
161
- - Value delivered by deliverable
162
- - What will be tested
163
- `;
164
- writeFile('docs/rfcs/RFC-TEMPLATE.md', rfcTemplate);
165
- logSuccess('Created RFC-TEMPLATE.md');
166
-
167
- logSuccess('Project structure created');
168
- }
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('rules/simplicity.md', simplicityContent);
242
+ logSuccess('Created simplicity.md');
169
243
 
170
- async function setupGitHubCLI() {
171
- logStep('GitHub CLI Setup');
172
- logInfo('To create GitHub labels automatically, you need GitHub CLI installed and authenticated.');
173
-
174
- // Check if gh is installed
175
- try {
176
- execSync('gh --version', { stdio: 'pipe' });
177
- logSuccess('GitHub CLI is already installed');
178
- } catch (error) {
179
- logWarning('GitHub CLI is not installed');
180
- logInfo('Installing GitHub CLI...');
181
- logInfo('šŸ“„ Download from: https://cli.github.com/');
182
- logInfo('šŸ’» Or use package manager:');
183
- logInfo(' Windows: winget install GitHub.cli');
184
- logInfo(' macOS: brew install gh');
185
- logInfo(' Ubuntu/Debian: sudo apt install gh');
186
- logInfo(' CentOS/RHEL: sudo yum install gh');
187
-
188
- const waitForInstall = await askQuestion('Press Enter after installing GitHub CLI, or type "skip" to continue without it');
189
- if (waitForInstall === 'skip') {
190
- return false;
191
- }
192
-
193
- // Check again
194
- try {
195
- execSync('gh --version', { stdio: 'pipe' });
196
- logSuccess('GitHub CLI is now available');
197
- } catch (error) {
198
- logWarning('GitHub CLI still not available, continuing without it');
199
- return false;
200
- }
201
- }
202
-
203
- // Check if authenticated
204
- try {
205
- execSync('gh auth status', { stdio: 'pipe' });
206
- logSuccess('GitHub CLI is already authenticated');
207
- return true;
208
- } catch (error) {
209
- logWarning('GitHub CLI is not authenticated');
210
- logInfo('You need to authenticate with GitHub to create labels automatically.');
211
- logInfo('šŸ” Run: gh auth login');
212
- logInfo(' This will open a browser for OAuth authentication');
213
-
214
- const waitForAuth = await askQuestion('Press Enter after authenticating, or type "skip" to continue without authentication');
215
- if (waitForAuth === 'skip') {
216
- return false;
217
- }
218
-
219
- // Check authentication again
220
- try {
221
- execSync('gh auth status', { stdio: 'pipe' });
222
- logSuccess('GitHub CLI is now authenticated');
223
- return true;
224
- } catch (error) {
225
- logWarning('GitHub CLI authentication failed, continuing without it');
226
- return false;
227
- }
228
- }
229
- }
244
+ // Create architecture.md
245
+ const architectureContent = `# Architecture
230
246
 
231
- function createGitHubLabels() {
232
- const labels = [
233
- { name: 'phase:design', color: '0e8a16', description: 'Design phase - RFC creation and review' },
234
- { name: 'phase:impl', color: '1d76db', description: 'Implementation phase - coding and testing' },
235
- { name: 'phase:tests', color: 'fef2c0', description: 'Testing phase - validation and QA' },
236
- { name: 'status:wip', color: 'fbca04', description: 'Work in progress' },
237
- { name: 'status:needs-review', color: 'd93f0b', description: 'Ready for review' },
238
- { name: 'status:complete', color: '0e8a16', description: 'Completed and approved' },
239
- { name: 'status:changes-requested', color: 'd93f0b', description: 'Changes requested in review' },
240
- { name: 'ai-agent:cursor', color: '5319e7', description: 'Assigned to Cursor AI agent' },
241
- { name: 'ai-agent:claude', color: 'c2e0c6', description: 'Assigned to Claude AI agent' },
242
- { name: 'ai-agent:windsurf', color: 'bfdadc', description: 'Assigned to Windsurf AI agent' }
243
- ];
244
-
245
- logInfo('Creating GitHub labels...');
246
-
247
- for (const label of labels) {
248
- try {
249
- const command = `gh label create "${label.name}" --color "${label.color}" --description "${label.description}"`;
250
- execSync(command, { stdio: 'pipe' });
251
- logSuccess(`Created label: ${label.name}`);
252
- } catch (error) {
253
- if (error.message.includes('already exists')) {
254
- logInfo(`Label already exists: ${label.name}`);
255
- } else {
256
- logWarning(`Failed to create label ${label.name}: ${error.message}`);
257
- }
258
- }
259
- }
260
-
261
- logSuccess('GitHub labels created');
262
- }
247
+ Maintain clean architectural boundaries by using appropriate technologies for each task.
263
248
 
264
- function createLabelsConfigFile() {
265
- const labels = [
266
- { name: 'phase:design', color: '0e8a16', description: 'Design phase - RFC creation and review' },
267
- { name: 'phase:impl', color: '1d76db', description: 'Implementation phase - coding and testing' },
268
- { name: 'phase:tests', color: 'fef2c0', description: 'Testing phase - validation and QA' },
269
- { name: 'status:wip', color: 'fbca04', description: 'Work in progress' },
270
- { name: 'status:needs-review', color: 'd93f0b', description: 'Ready for review' },
271
- { name: 'status:complete', color: '0e8a16', description: 'Completed and approved' },
272
- { name: 'status:changes-requested', color: 'd93f0b', description: 'Changes requested in review' },
273
- { name: 'ai-agent:cursor', color: '5319e7', description: 'Assigned to Cursor AI agent' },
274
- { name: 'ai-agent:claude', color: 'c2e0c6', description: 'Assigned to Claude AI agent' },
275
- { name: 'ai-agent:windsurf', color: 'bfdadc', description: 'Assigned to Windsurf AI agent' }
276
- ];
277
-
278
- const labelsContent = JSON.stringify(labels, null, 2);
279
- writeFile('.github/labels.json', labelsContent);
280
-
281
- logSuccess('GitHub labels configuration file created');
282
- logInfo('You can import these labels using:');
283
- logInfo('1. GitHub web interface: Settings > Labels > Import labels');
284
- logInfo('2. Or manually create each label with the provided colors and descriptions');
285
- }
249
+ ## Core Principles
286
250
 
287
- function createGitHubWorkflows() {
288
- // Get the directory where this script is located (FRAIM package directory)
289
- const fraimDir = __dirname;
290
-
291
- // Copy actual workflow files from FRAIM/github folder
292
- const workflowsSrc = path.join(fraimDir, 'github');
293
- if (fs.existsSync(workflowsSrc)) {
294
- copyDirectory(workflowsSrc, '.github/workflows');
295
- logSuccess('GitHub workflows copied from FRAIM/github folder');
296
- } else {
297
- logWarning(`github folder not found at ${workflowsSrc}, skipping workflow creation`);
298
- }
299
- }
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.
300
256
 
301
- function createAgentFolders() {
302
- // Get the directory where this script is located (FRAIM package directory)
303
- const fraimDir = __dirname;
304
-
305
- // Create .cursor folder at top level with all contents
306
- const cursorSrc = path.join(fraimDir, 'agents', 'cursor');
307
- if (fs.existsSync(cursorSrc)) {
308
- copyDirectory(cursorSrc, '.cursor');
309
- logSuccess('Created .cursor folder with all contents');
310
- } else {
311
- logWarning(`agents/cursor directory not found at ${cursorSrc}, skipping .cursor creation`);
312
- }
257
+ ## Guidelines
313
258
 
314
- // Create .windsurf folder at top level with all contents
315
- const windsurfSrc = path.join(fraimDir, 'agents', 'windsurf');
316
- if (fs.existsSync(windsurfSrc)) {
317
- copyDirectory(windsurfSrc, '.windsurf');
318
- logSuccess('Created .windsurf folder with all contents');
319
- } else {
320
- logWarning(`agents/windsurf directory not found at ${windsurfSrc}, skipping .windsurf creation`);
321
- }
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
322
264
 
323
- // Create CLAUDE.md at top level
324
- const claudeSrc = path.join(fraimDir, 'agents', 'claude', 'CLAUDE.md');
325
- if (fs.existsSync(claudeSrc)) {
326
- const claudeContent = fs.readFileSync(claudeSrc, 'utf8');
327
- writeFile('CLAUDE.md', claudeContent);
328
- logSuccess('Created CLAUDE.md at top level');
329
- } else {
330
- logWarning(`agents/claude/CLAUDE.md not found at ${claudeSrc}, skipping CLAUDE.md creation`);
331
- }
332
- }
265
+ ## Technology Selection
333
266
 
334
- async function runWizard() {
335
- logHeader('šŸ”® FRAIM Interactive Setup Wizard');
336
- log('Welcome to the FRAIM setup wizard! I\'ll guide you through each step.\n');
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('rules/architecture.md', architectureContent);
272
+ logSuccess('Created architecture.md');
337
273
 
338
- try {
339
- // Check prerequisites
340
- logStep('Step 1: Checking Prerequisites');
341
-
342
- // Check if we're in a git repository
343
- try {
344
- execSync('git rev-parse --git-dir', { stdio: 'pipe' });
345
- logSuccess('Running in a git repository');
346
- } catch (error) {
347
- logError('Not in a git repository');
348
- logInfo('Please run this command from within a git repository');
349
- return;
350
- }
274
+ // Create continuous-learning.md
275
+ const continuousLearningContent = `# Continuous Learning
351
276
 
352
- // Step 2: Project Structure
353
- logStep('Step 2: Project Structure');
354
- const setupStructure = await askQuestion('Would you like to create project structure (retrospectives, docs/rfcs with templates)?', 'y');
355
-
356
- if (setupStructure === 'y' || setupStructure === 'yes') {
357
- createProjectStructure();
358
- } else {
359
- logInfo('Skipping project structure setup');
360
- }
277
+ Prevent repeating past mistakes by systematically learning from retrospectives, RFCs, and historical issue patterns.
361
278
 
362
- // Step 3: AI Agent Setup
363
- logStep('Step 3: AI Agent Configuration');
364
- const setupAgents = await askQuestion('Would you like to set up AI agent configurations (.cursor, .windsurf, CLAUDE.md)?', 'y');
365
-
366
- if (setupAgents === 'y' || setupAgents === 'yes') {
367
- createAgentFolders();
368
- } else {
369
- logInfo('Skipping AI agent setup');
370
- }
279
+ ## Core Principles
371
280
 
372
- // Step 4: GitHub Workflows
373
- logStep('Step 4: GitHub Workflows');
374
- const setupWorkflows = await askQuestion('Would you like to set up GitHub workflows for automation?', 'y');
375
-
376
- if (setupWorkflows === 'y' || setupWorkflows === 'yes') {
377
- ensureDirectory('.github/workflows');
378
- createGitHubWorkflows();
379
- } else {
380
- logInfo('Skipping GitHub workflow setup');
381
- }
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.
382
286
 
383
- // Step 5: GitHub Labels
384
- logStep('Step 5: GitHub Labels');
385
- const setupLabels = await askQuestion('Would you like to create GitHub labels for FRAIM?', 'y');
386
-
387
- if (setupLabels === 'y' || setupLabels === 'yes') {
388
- const ghAvailable = await setupGitHubCLI();
389
- if (ghAvailable) {
390
- createGitHubLabels();
391
- } else {
392
- logInfo('GitHub CLI not available - creating labels configuration file instead');
393
- createLabelsConfigFile();
394
- }
395
- } else {
396
- logInfo('Skipping GitHub label setup');
397
- }
287
+ ## Guidelines
398
288
 
399
- // Step 6: Summary
400
- logStep('Step 6: Setup Summary');
401
- logHeader('šŸŽ‰ Setup Complete!');
402
- logSuccess('FRAIM has been successfully set up in your repository!');
403
- logInfo('Next steps:');
404
- logInfo('1. Commit and push these files to GitHub');
405
- logInfo('2. Import GitHub labels from .github/labels.json using the web interface');
406
- logInfo('3. Create your first issue with phase labels');
407
- logInfo('4. Start coordinating your AI agents!');
408
-
409
- logInfo('\nšŸ“š Learn more about FRAIM:');
410
- logInfo('https://github.com/mathursrus/Ashley-Calendar-AI/tree/master/FRAIM');
411
-
412
- logInfo('\n🧠 Learn the RIGOR methodology:');
413
- logInfo('npx fraim-framework rigor');
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
414
294
 
415
- } catch (error) {
416
- logError(`Wizard failed: ${error.message}`);
417
- process.exit(1);
418
- }
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('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('rules/successful-debugging-patterns.md', debuggingContent);
336
+ logSuccess('Created successful-debugging-patterns.md');
419
337
  }
420
338
 
421
- async function runSetup() {
422
- logHeader('šŸš€ FRAIM Quick Setup');
423
- log('Setting up FRAIM in current repository...\n');
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('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('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('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('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('workflows/retrospect.md', retrospectContent);
597
+ logSuccess('Created retrospect.md workflow');
598
+ }
424
599
 
425
- try {
426
- // Check prerequisites
427
- try {
428
- execSync('git rev-parse --git-dir', { stdio: 'pipe' });
429
- } catch (error) {
430
- logError('Not in a git repository');
431
- logInfo('Please run this command from within a git repository');
432
- process.exit(1);
433
- }
600
+ // Create project structure
601
+ function createProjectStructure() {
602
+ // Create directories
603
+ ensureDirectory('retrospectives');
604
+ ensureDirectory('docs/rfcs');
605
+ ensureDirectory('rules');
606
+ ensureDirectory('templates/evidence');
607
+ ensureDirectory('templates/retrospective');
608
+ ensureDirectory('templates/specs');
609
+ ensureDirectory('templates/help');
610
+ ensureDirectory('workflows');
611
+ ensureDirectory('.github/workflows');
612
+ ensureDirectory('agents/cursor');
613
+ ensureDirectory('agents/claude');
614
+ ensureDirectory('agents/windsurf');
615
+ ensureDirectory('scripts');
616
+
617
+ logSuccess('Created directory structure');
434
618
 
435
- // Create everything at once
436
- createProjectStructure();
437
- ensureDirectory('.github/workflows');
438
- createAgentFolders();
439
- createGitHubWorkflows();
440
-
441
- // Check GitHub CLI availability for labels
442
- try {
443
- execSync('gh --version', { stdio: 'pipe' });
444
- try {
445
- execSync('gh auth status', { stdio: 'pipe' });
446
- logInfo('GitHub CLI available and authenticated - creating labels automatically');
447
- createGitHubLabels();
448
- } catch (error) {
449
- logWarning('GitHub CLI not authenticated - creating labels configuration file instead');
450
- createLabelsConfigFile();
451
- }
452
- } catch (error) {
453
- logInfo('GitHub CLI not available - creating labels configuration file instead');
454
- createLabelsConfigFile();
455
- }
619
+ // Create BUGFIX template
620
+ const bugfixTemplate = `Issue: #<issue>
456
621
 
457
- logHeader('šŸŽ‰ Setup Complete!');
458
- logSuccess('FRAIM has been successfully set up in your repository!');
459
- logInfo('Next steps:');
460
- logInfo('1. Commit and push these files to GitHub');
461
- logInfo('2. Import GitHub labels from .github/labels.json using the web interface');
462
- logInfo('3. Create your first issue with phase labels');
463
- logInfo('4. Start coordinating your AI agents!');
464
-
465
- logInfo('\nšŸ“š Learn more about FRAIM:');
466
- logInfo('https://github.com/mathursrus/Ashley-Calendar-AI/tree/master/FRAIM');
467
-
468
- logInfo('\n🧠 Learn the RIGOR methodology:');
469
- logInfo('npx fraim-framework rigor');
622
+ ## Tests
623
+ - Could be existing tests that are failing and need to be fixed
624
+ - Could be new tests that need to be added into an existing test suite
625
+ - Could be a new test suite
626
+ `;
627
+ writeFile('docs/rfcs/BUGFIX-TEMPLATE.md', bugfixTemplate);
628
+ logSuccess('Created BUGFIX-TEMPLATE.md');
470
629
 
630
+ // Create RFC template
631
+ const rfcTemplate = `# RFC: <Title>
632
+
633
+ Issue: #<issue>
634
+ Owner: <agent>
635
+
636
+ ## Design Details
637
+ - User Experience changes (incl. all modalities currently supported: see codebase to know which ones)
638
+ - API surface (OpenAPI) changes
639
+ - Data model / schema changes
640
+ - Failure modes & timeouts
641
+ - Telemetry & analytics
642
+
643
+ ## Test Matrix
644
+ - Unit: modules & edge cases
645
+ - Integration: API <-> DB <-> external
646
+ - E2E: user flows (happy/sad)`;
647
+ writeFile('docs/rfcs/RFC-TEMPLATE.md', rfcTemplate);
648
+ logSuccess('Created RFC-TEMPLATE.md');
649
+
650
+ // Create basic rule files
651
+ createRuleFiles();
652
+ logSuccess('Created rule files');
653
+
654
+ // Create workflow templates
655
+ createWorkflowTemplates();
656
+ logSuccess('Created workflow templates');
657
+
658
+ // Create basic CODEOWNERS file
659
+ const codeownersContent = `# This file defines the code owners for the repository
660
+ # Code owners are automatically requested for review when someone opens a PR that modifies code they own
661
+ # See: https://docs.github.com/en/repositories/managing-your-codebase-in-github/about-code-owners
662
+
663
+ # Default owners for everything in the repo
664
+ * @${process.env.USER || 'repo-owner'}
665
+
666
+ # Specific ownership for different parts of the codebase
667
+ /rules/ @${process.env.USER || 'repo-owner'}
668
+ /workflows/ @${process.env.USER || 'repo-owner'}
669
+ /templates/ @${process.env.USER || 'repo-owner'}
670
+ /scripts/ @${process.env.USER || 'repo-owner'}
671
+ /.github/ @${process.env.USER || 'repo-owner'}
672
+
673
+ # Documentation
674
+ /docs/ @${process.env.USER || 'repo-owner'}
675
+ *.md @${process.env.USER || 'repo-owner'}`;
676
+ writeFile('CODEOWNERS', codeownersContent);
677
+ logSuccess('Created CODEOWNERS file');
678
+
679
+ // Create basic PR template
680
+ const prTemplateContent = `# Pull Request
681
+
682
+ ## Description
683
+ <!-- Provide a brief description of the changes in this PR -->
684
+
685
+ ## Related Issue
686
+ <!-- Link to the issue this PR addresses (use format: Closes #123, Fixes #123) -->
687
+
688
+ ## Type of Change
689
+ <!-- Mark the appropriate option with an [x] -->
690
+ - [ ] Bug fix
691
+ - [ ] New feature
692
+ - [ ] Documentation update
693
+ - [ ] Code refactoring
694
+ - [ ] Performance improvement
695
+ - [ ] Tests
696
+ - [ ] Build/CI changes
697
+ - [ ] Other (please describe):
698
+
699
+ ## Implementation Details
700
+ <!-- Provide a detailed description of the implementation -->
701
+
702
+ ## Testing
703
+ <!-- Describe the testing you've done -->
704
+ - [ ] Added unit tests
705
+ - [ ] Added integration tests
706
+ - [ ] Manually tested
707
+ - [ ] Test exempt (explain why)
708
+
709
+ ## Evidence
710
+ <!-- Provide evidence of testing (screenshots, logs, etc.) -->
711
+
712
+ ## Checklist
713
+ <!-- Mark items with [x] once completed -->
714
+ - [ ] Code follows project style guidelines
715
+ - [ ] Documentation has been updated
716
+ - [ ] All tests are passing
717
+ - [ ] PR has been reviewed by at least one team member
718
+ - [ ] Changes have been tested in a development environment
719
+
720
+ ## Additional Notes
721
+ <!-- Any additional information that might be helpful for reviewers -->`;
722
+ writeFile('.github/pull_request_template.md', prTemplateContent);
723
+ logSuccess('Created PR template');
724
+
725
+ // Create labels.json
726
+ const labelsContent = `[
727
+ {
728
+ "name": "aiagents",
729
+ "color": "0e8a16",
730
+ "description": "Issue prepared for AI agent collaboration"
731
+ },
732
+ {
733
+ "name": "status:ready-for-design",
734
+ "color": "0075ca",
735
+ "description": "Issue is ready for design phase"
736
+ },
737
+ {
738
+ "name": "status:in-design",
739
+ "color": "0075ca",
740
+ "description": "Issue is currently in design phase"
741
+ },
742
+ {
743
+ "name": "status:ready-for-implementation",
744
+ "color": "7057ff",
745
+ "description": "Issue is ready for implementation phase"
746
+ },
747
+ {
748
+ "name": "status:in-implementation",
749
+ "color": "7057ff",
750
+ "description": "Issue is currently in implementation phase"
751
+ },
752
+ {
753
+ "name": "status:ready-for-testing",
754
+ "color": "008672",
755
+ "description": "Issue is ready for testing phase"
756
+ },
757
+ {
758
+ "name": "status:in-testing",
759
+ "color": "008672",
760
+ "description": "Issue is currently in testing phase"
761
+ },
762
+ {
763
+ "name": "status:test-exempt",
764
+ "color": "c5def5",
765
+ "description": "Implementation is exempt from test requirements"
766
+ },
767
+ {
768
+ "name": "status:blocked",
769
+ "color": "d73a4a",
770
+ "description": "Issue is blocked by another issue or external factor"
771
+ },
772
+ {
773
+ "name": "status:needs-review",
774
+ "color": "fbca04",
775
+ "description": "Issue or PR needs review"
776
+ },
777
+ {
778
+ "name": "status:approved",
779
+ "color": "0e8a16",
780
+ "description": "Issue or PR has been approved"
781
+ },
782
+ {
783
+ "name": "status:needs-revision",
784
+ "color": "d93f0b",
785
+ "description": "Issue or PR needs revision based on feedback"
786
+ },
787
+ {
788
+ "name": "priority:high",
789
+ "color": "d93f0b",
790
+ "description": "High priority issue"
791
+ },
792
+ {
793
+ "name": "priority:medium",
794
+ "color": "fbca04",
795
+ "description": "Medium priority issue"
796
+ },
797
+ {
798
+ "name": "priority:low",
799
+ "color": "c5def5",
800
+ "description": "Low priority issue"
801
+ }
802
+ ]`;
803
+ writeFile('labels.json', labelsContent);
804
+ logSuccess('Created labels.json');
805
+ }
806
+
807
+ // Export the main setup function
808
+ function runSetup() {
809
+ console.log('šŸš€ Setting up FRAIM in current repository...\n');
810
+
811
+ try {
812
+ createProjectStructure();
813
+ console.log('\nāœ… FRAIM setup complete!');
814
+ console.log('šŸŽÆ Your repository is now ready for AI agent management.');
815
+ console.log('šŸ“š Next steps:');
816
+ console.log(' 1. Customize .ai-agents/rules/architecture.md for your project');
817
+ console.log(' 2. Update .ai-agents/scripts/cleanup-branch.ts with your cleanup logic');
818
+ console.log(' 3. Copy scripts from sample_package.json to your package.json');
819
+ console.log(' 4. Start creating issues with phase labels!');
471
820
  } catch (error) {
472
- logError(`Setup failed: ${error.message}`);
473
- process.exit(1);
821
+ console.error('āŒ Setup failed:', error.message);
822
+ throw error;
474
823
  }
475
824
  }
476
825
 
477
- // Run setup if this script is executed directly
826
+ // If this file is run directly, execute setup
478
827
  if (require.main === module) {
479
828
  runSetup();
480
829
  }
481
830
 
482
- module.exports = { runSetup, runWizard, createProjectStructure };
831
+ module.exports = { runSetup };