fraim-framework 1.0.3 → 1.0.4

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 (2) hide show
  1. package/package.json +1 -1
  2. package/setup.js +92 -182
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fraim-framework",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "FRAIM: Framework for Rigor-based AI Management - Where humans become AI managers through rigorous methodology",
5
5
  "main": "index.js",
6
6
  "bin": {
package/setup.js CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  const fs = require('fs');
4
4
  const path = require('path');
5
+ const { execSync } = require('child_process');
5
6
 
6
7
  // Colors for console output
7
8
  const colors = {
@@ -53,141 +54,57 @@ function writeFile(filePath, content) {
53
54
  logSuccess(`Created file: ${filePath}`);
54
55
  }
55
56
 
56
- function createAgentStructure() {
57
- // Create the proper agent directory structure
58
- ensureDirectory('agents/cursor/rules');
59
- ensureDirectory('agents/claude/rules');
60
- ensureDirectory('agents/windsurf/rules');
61
-
62
- // Create .cursorrules that references modular rules
63
- const cursorRules = `# FRAIM Cursor Rules
64
-
65
- ## Core Rules (Always Apply)
66
- - **ashley-architecture.mdc** - Follow the established architecture patterns
67
- - **continuous-learning.mdc** - Always review retrospectives and RFCs before starting work
68
- - **local-development.mdc** - Work locally, coordinate remotely
69
- - **simplicity.mdc** - Keep it simple, don't over-engineer
70
- - **software-development-lifecycle.mdc** - Follow the established SDLC
71
-
72
- ## Phase-Specific Rules (Manual Trigger Only)
73
- - **prep.mdc** - Preparation phase rules
74
- - **design.mdc** - Design phase rules
75
- - **implement.mdc** - Implementation phase rules
76
- - **test.mdc** - Testing phase rules
77
- - **resolve.mdc** - Resolution phase rules
78
- - **cursor-workflow.mdc** - Cursor-specific workflow rules
79
-
80
- ## Key Behavioral Requirements
81
- - Always verify actions taken
82
- - Never expect user verification
83
- - Run tests to verify expected behavior
84
- - Link work to issues with "Closes #<n>"
85
- - Open Draft PRs early for review
86
-
87
- ## Project Structure Awareness
88
- - Work in feature branches only
89
- - Never push to master
90
- - Use local file system for development
91
- - Coordinate through GitHub issues and PRs
92
-
93
- ## Tool Usage Guidelines
94
- - Use local file system for development work
95
- - Use GitHub MCP for issue management
96
- - Use local Git for version control
97
- - Test locally before committing
98
-
99
- ## FRAIM Integration
100
- - Follow the RIGOR methodology
101
- - Maintain isolation between agents
102
- - Use GitOps for coordination
103
- - Enable observability through clear documentation
104
- `;
105
-
106
- // Create .windsurfrules that references modular rules
107
- const windsurfRules = `# FRAIM Windsurf Rules
108
-
109
- ## Core Rules (Always Apply)
110
- - **ashley-architecture.mdc** - Follow the established architecture patterns
111
- - **continuous-learning.mdc** - Always review retrospectives and RFCs before starting work
112
- - **local-development.mdc** - Work locally, coordinate remotely
113
- - **simplicity.mdc** - Keep it simple, don't over-engineer
114
- - **issue-resolution-process.mdc** - Follow the established issue resolution process
115
-
116
- ## Key Behavioral Requirements
117
- - Always verify actions taken
118
- - Never expect user verification
119
- - Run tests to verify expected behavior
120
- - Link work to issues with "Closes #<n>"
121
- - Open Draft PRs early for review
122
-
123
- ## Project Structure Awareness
124
- - Work in feature branches only
125
- - Never push to master
126
- - Use local file system for development
127
- - Coordinate through GitHub issues and PRs
128
-
129
- ## Tool Usage Guidelines
130
- - Use local file system for development work
131
- - Use GitHub MCP for issue management
132
- - Use local Git for version control
133
- - Test locally before committing
134
-
135
- ## Architecture and Optimization Principles
136
- - Follow established patterns
137
- - Optimize for performance and maintainability
138
- - Document architectural decisions
139
- - Consider scalability and security
140
-
141
- ## Your Role in FRAIM
142
- - Provide technical expertise and optimization
143
- - Maintain code quality and standards
144
- - Ensure architectural consistency
145
- - Support other agents with technical guidance
146
- `;
57
+ function copyDirectory(src, dest) {
58
+ if (!fs.existsSync(dest)) {
59
+ fs.mkdirSync(dest, { recursive: true });
60
+ }
61
+
62
+ const items = fs.readdirSync(src);
63
+ for (const item of items) {
64
+ const srcPath = path.join(src, item);
65
+ const destPath = path.join(dest, item);
66
+
67
+ if (fs.statSync(srcPath).isDirectory()) {
68
+ copyDirectory(srcPath, destPath);
69
+ } else {
70
+ fs.copyFileSync(srcPath, destPath);
71
+ logSuccess(`Copied: ${destPath}`);
72
+ }
73
+ }
74
+ }
147
75
 
148
- // Create CLAUDE.md that references modular rules
149
- const claudeRules = `# FRAIM Claude Rules
150
-
151
- ## Always-On Rules
152
- - **ashley-architecture.mdc** - Follow the established architecture patterns
153
- - **continuous-learning.mdc** - Always review retrospectives and RFCs before starting work
154
-
155
- ## Phase-Specific Rules (Manual Trigger Only)
156
- - **design.mdc** - Design phase rules
157
- - **implement.mdc** - Implementation phase rules
158
- - **test.mdc** - Testing phase rules
159
-
160
- ## Key Behavioral Requirements
161
- - Always verify actions taken
162
- - Never expect user verification
163
- - Run tests to verify expected behavior
164
- - Link work to issues with "Closes #<n>"
165
- - Open Draft PRs early for review
166
-
167
- ## Project Structure Awareness
168
- - Work in feature branches only
169
- - Never push to master
170
- - Use local file system for development
171
- - Coordinate through GitHub issues and PRs
172
-
173
- ## Tool Usage Guidelines
174
- - Use local file system for development work
175
- - Use GitHub MCP for issue management
176
- - Use local Git for version control
177
- - Test locally before committing
178
-
179
- ## FRAIM Integration
180
- - Follow the RIGOR methodology
181
- - Maintain isolation between agents
182
- - Use GitOps for coordination
183
- - Enable observability through clear documentation
184
- `;
76
+ function createGitHubLabels() {
77
+ const labels = [
78
+ { name: 'phase:design', color: '0e8a16', description: 'Design phase - RFC creation and review' },
79
+ { name: 'phase:impl', color: '1d76db', description: 'Implementation phase - coding and testing' },
80
+ { name: 'phase:tests', color: 'fef2c0', description: 'Testing phase - validation and QA' },
81
+ { name: 'status:wip', color: 'fbca04', description: 'Work in progress' },
82
+ { name: 'status:needs-review', color: 'd93f0b', description: 'Ready for review' },
83
+ { name: 'status:complete', color: '0e8a16', description: 'Completed and approved' },
84
+ { name: 'status:approved', color: '0e8a16', description: 'Approved and ready to merge' },
85
+ { name: 'status:changes-requested', color: 'd93f0b', description: 'Changes requested in review' },
86
+ { name: 'ai-agent:cursor', color: '5319e7', description: 'Assigned to Cursor AI agent' },
87
+ { name: 'ai-agent:claude', color: 'c2e0c6', description: 'Assigned to Claude AI agent' },
88
+ { name: 'ai-agent:windsurf', color: 'bfdadc', description: 'Assigned to Windsurf AI agent' }
89
+ ];
185
90
 
186
- writeFile('.cursorrules', cursorRules);
187
- writeFile('.windsurfrules', windsurfRules);
188
- writeFile('CLAUDE.md', claudeRules);
91
+ logInfo('Creating GitHub labels...');
189
92
 
190
- logSuccess('AI agent configuration files created');
93
+ for (const label of labels) {
94
+ try {
95
+ const command = `gh label create "${label.name}" --color "${label.color}" --description "${label.description}"`;
96
+ execSync(command, { stdio: 'pipe' });
97
+ logSuccess(`Created label: ${label.name}`);
98
+ } catch (error) {
99
+ if (error.message.includes('already exists')) {
100
+ logInfo(`Label already exists: ${label.name}`);
101
+ } else {
102
+ logWarning(`Failed to create label ${label.name}: ${error.message}`);
103
+ }
104
+ }
105
+ }
106
+
107
+ logSuccess('GitHub labels created');
191
108
  }
192
109
 
193
110
  function createGitHubWorkflows() {
@@ -285,55 +202,31 @@ jobs:
285
202
  logSuccess('GitHub workflows created');
286
203
  }
287
204
 
288
- function createGitHubLabels() {
289
- const labels = [
290
- { name: 'phase:design', color: '0e8a16', description: 'Design phase - RFC creation and review' },
291
- { name: 'phase:impl', color: '1d76db', description: 'Implementation phase - coding and testing' },
292
- { name: 'phase:tests', color: 'fef2c0', description: 'Testing phase - validation and QA' },
293
- { name: 'status:wip', color: 'fbca04', description: 'Work in progress' },
294
- { name: 'status:needs-review', color: 'd93f0b', description: 'Ready for review' },
295
- { name: 'status:complete', color: '0e8a16', description: 'Completed and approved' },
296
- { name: 'status:approved', color: '0e8a16', description: 'Approved and ready to merge' },
297
- { name: 'status:changes-requested', color: 'd93f0b', description: 'Changes requested in review' },
298
- { name: 'ai-agent:cursor', color: '5319e7', description: 'Assigned to Cursor AI agent' },
299
- { name: 'ai-agent:claude', color: 'c2e0c6', description: 'Assigned to Claude AI agent' },
300
- { name: 'ai-agent:windsurf', color: 'bfdadc', description: 'Assigned to Windsurf AI agent' }
301
- ];
205
+ function createAgentFolders() {
206
+ // Create .cursor folder at top level with all contents
207
+ if (fs.existsSync('agents/cursor')) {
208
+ copyDirectory('agents/cursor', '.cursor');
209
+ logSuccess('Created .cursor folder with all contents');
210
+ } else {
211
+ logWarning('agents/cursor directory not found, skipping .cursor creation');
212
+ }
302
213
 
303
- const labelsContent = JSON.stringify(labels, null, 2);
304
- writeFile('.github/labels.json', labelsContent);
305
-
306
- logInfo('GitHub labels configuration created');
307
- logInfo('You can import these labels using GitHub CLI or the web interface');
308
- logInfo('Or use the GitHub web interface: Settings > Labels > Import labels');
309
- }
214
+ // Create .windsurf folder at top level with all contents
215
+ if (fs.existsSync('agents/windsurf')) {
216
+ copyDirectory('agents/windsurf', '.windsurf');
217
+ logSuccess('Created .windsurf folder with all contents');
218
+ } else {
219
+ logWarning('agents/windsurf directory not found, skipping .windsurf creation');
220
+ }
310
221
 
311
- function createFRAIMConfig() {
312
- const fraimConfig = {
313
- version: "1.0.0",
314
- framework: "FRAIM",
315
- description: "Framework for Rigor-based AI Management",
316
- created: new Date().toISOString(),
317
- features: [
318
- "GitHub label automation",
319
- "AI agent coordination",
320
- "Phase-based workflows",
321
- "RIGOR methodology implementation"
322
- ],
323
- agents: {
324
- cursor: ".cursorrules",
325
- claude: "CLAUDE.md",
326
- windsurf: ".windsurfrules"
327
- },
328
- workflows: [
329
- ".github/workflows/phase-change.yml",
330
- ".github/workflows/status-change.yml",
331
- ".github/workflows/sync-on-pr-review.yml"
332
- ]
333
- };
334
-
335
- writeFile('fraim-config.json', JSON.stringify(fraimConfig, null, 2));
336
- logSuccess('FRAIM configuration created');
222
+ // Create CLAUDE.md at top level
223
+ if (fs.existsSync('agents/claude/CLAUDE.md')) {
224
+ const claudeContent = fs.readFileSync('agents/claude/CLAUDE.md', 'utf8');
225
+ writeFile('CLAUDE.md', claudeContent);
226
+ logSuccess('Created CLAUDE.md at top level');
227
+ } else {
228
+ logWarning('agents/claude/CLAUDE.md not found, skipping CLAUDE.md creation');
229
+ }
337
230
  }
338
231
 
339
232
  function runSetup() {
@@ -341,20 +234,37 @@ function runSetup() {
341
234
  log('Setting up FRAIM in current repository...\n');
342
235
 
343
236
  try {
237
+ // Check if gh CLI is available
238
+ try {
239
+ execSync('gh --version', { stdio: 'pipe' });
240
+ } catch (error) {
241
+ logError('GitHub CLI (gh) is not installed or not available');
242
+ logInfo('Please install GitHub CLI: https://cli.github.com/');
243
+ process.exit(1);
244
+ }
245
+
246
+ // Check if we're in a git repository
247
+ try {
248
+ execSync('git rev-parse --git-dir', { stdio: 'pipe' });
249
+ } catch (error) {
250
+ logError('Not in a git repository');
251
+ logInfo('Please run this command from within a git repository');
252
+ process.exit(1);
253
+ }
254
+
344
255
  // Create only essential directory structure
345
256
  ensureDirectory('.github/workflows');
346
257
 
347
258
  // Create all components
348
- createAgentStructure();
259
+ createAgentFolders();
349
260
  createGitHubWorkflows();
350
261
  createGitHubLabels();
351
- createFRAIMConfig();
352
262
 
353
263
  logHeader('🎉 Setup Complete!');
354
264
  logSuccess('FRAIM has been successfully set up in your repository!');
355
265
  logInfo('Next steps:');
356
266
  logInfo('1. Commit and push these files to GitHub');
357
- logInfo('2. Import the GitHub labels from .github/labels.json');
267
+ logInfo('2. The GitHub labels have been created automatically');
358
268
  logInfo('3. Create your first issue with phase labels');
359
269
  logInfo('4. Start coordinating your AI agents!');
360
270