fraim-framework 1.0.2 → 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 +112 -173
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fraim-framework",
3
- "version": "1.0.2",
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,6 +54,25 @@ function writeFile(filePath, content) {
53
54
  logSuccess(`Created file: ${filePath}`);
54
55
  }
55
56
 
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
+ }
75
+
56
76
  function createGitHubLabels() {
57
77
  const labels = [
58
78
  { name: 'phase:design', color: '0e8a16', description: 'Design phase - RFC creation and review' },
@@ -61,16 +81,30 @@ function createGitHubLabels() {
61
81
  { name: 'status:wip', color: 'fbca04', description: 'Work in progress' },
62
82
  { name: 'status:needs-review', color: 'd93f0b', description: 'Ready for review' },
63
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' },
64
86
  { name: 'ai-agent:cursor', color: '5319e7', description: 'Assigned to Cursor AI agent' },
65
87
  { name: 'ai-agent:claude', color: 'c2e0c6', description: 'Assigned to Claude AI agent' },
66
88
  { name: 'ai-agent:windsurf', color: 'bfdadc', description: 'Assigned to Windsurf AI agent' }
67
89
  ];
68
90
 
69
- const labelsContent = JSON.stringify(labels, null, 2);
70
- writeFile('.github/labels.json', labelsContent);
91
+ logInfo('Creating GitHub labels...');
92
+
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
+ }
71
106
 
72
- logInfo('GitHub labels configuration created');
73
- logInfo('You can import these labels using GitHub CLI or the web interface');
107
+ logSuccess('GitHub labels created');
74
108
  }
75
109
 
76
110
  function createGitHubWorkflows() {
@@ -127,205 +161,110 @@ jobs:
127
161
  echo "Issue ready for review - notifying team"
128
162
  `;
129
163
 
164
+ // Sync on PR review workflow
165
+ const syncOnPRReviewWorkflow = `name: Sync on PR Review
166
+
167
+ on:
168
+ pull_request_review:
169
+ types: [submitted, edited, dismissed]
170
+
171
+ jobs:
172
+ sync-review:
173
+ runs-on: ubuntu-latest
174
+ steps:
175
+ - name: Checkout
176
+ uses: actions/checkout@v4
177
+
178
+ - name: Sync Review Status
179
+ env:
180
+ GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}
181
+ run: |
182
+ PR_NUMBER="\${{ github.event.pull_request.number }}"
183
+ REVIEW_STATE="\${{ github.event.review.state }}"
184
+
185
+ echo "PR #\$PR_NUMBER review state: \$REVIEW_STATE"
186
+
187
+ if [ "\$REVIEW_STATE" = "approved" ]; then
188
+ echo "PR approved - updating status"
189
+ gh pr edit \$PR_NUMBER --add-label "status:approved"
190
+ elif [ "\$REVIEW_STATE" = "changes_requested" ]; then
191
+ echo "Changes requested - updating status"
192
+ gh pr edit \$PR_NUMBER --add-label "status:changes-requested"
193
+ fi
194
+
195
+ echo "Review sync complete"
196
+ `;
197
+
130
198
  writeFile('.github/workflows/phase-change.yml', phaseChangeWorkflow);
131
199
  writeFile('.github/workflows/status-change.yml', statusChangeWorkflow);
200
+ writeFile('.github/workflows/sync-on-pr-review.yml', syncOnPRReviewWorkflow);
132
201
 
133
202
  logSuccess('GitHub workflows created');
134
203
  }
135
204
 
136
- function createAgentConfigs() {
137
- // Cursor rules - only create if it doesn't exist
138
- if (!fs.existsSync('.cursorrules')) {
139
- const cursorRules = `# FRAIM Cursor Rules
140
-
141
- ## Core Rules (Always Apply)
142
- - **ashley-architecture.mdc** - Follow the established architecture patterns
143
- - **continuous-learning.mdc** - Always review retrospectives and RFCs before starting work
144
- - **local-development.mdc** - Work locally, coordinate remotely
145
- - **simplicity.mdc** - Keep it simple, don't over-engineer
146
- - **software-development-lifecycle.mdc** - Follow the established SDLC
147
-
148
- ## Phase-Specific Rules (Manual Trigger Only)
149
- - **prep.mdc** - Preparation phase rules
150
- - **design.mdc** - Design phase rules
151
- - **implement.mdc** - Implementation phase rules
152
- - **test.mdc** - Testing phase rules
153
- - **resolve.mdc** - Resolution phase rules
154
- - **cursor-workflow.mdc** - Cursor-specific workflow rules
155
-
156
- ## Key Behavioral Requirements
157
- - Always verify actions taken
158
- - Never expect user verification
159
- - Run tests to verify expected behavior
160
- - Link work to issues with "Closes #<n>"
161
- - Open Draft PRs early for review
162
-
163
- ## Project Structure Awareness
164
- - Work in feature branches only
165
- - Never push to master
166
- - Use local file system for development
167
- - Coordinate through GitHub issues and PRs
168
-
169
- ## Tool Usage Guidelines
170
- - Use local file system for development work
171
- - Use GitHub MCP for issue management
172
- - Use local Git for version control
173
- - Test locally before committing
174
-
175
- ## FRAIM Integration
176
- - Follow the RIGOR methodology
177
- - Maintain isolation between agents
178
- - Use GitOps for coordination
179
- - Enable observability through clear documentation
180
- `;
181
-
182
- writeFile('.cursorrules', cursorRules);
183
- logSuccess('Cursor rules created');
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');
184
210
  } else {
185
- logInfo('Cursor rules already exist, skipping');
211
+ logWarning('agents/cursor directory not found, skipping .cursor creation');
186
212
  }
187
213
 
188
- // Claude rules - only create if it doesn't exist
189
- if (!fs.existsSync('CLAUDE.md')) {
190
- const claudeRules = `# FRAIM Claude Rules
191
-
192
- ## Always-On Rules
193
- - **ashley-architecture.mdc** - Follow the established architecture patterns
194
- - **continuous-learning.mdc** - Always review retrospectives and RFCs before starting work
195
-
196
- ## Phase-Specific Rules (Manual Trigger Only)
197
- - **design.mdc** - Design phase rules
198
- - **implement.mdc** - Implementation phase rules
199
- - **test.mdc** - Testing phase rules
200
-
201
- ## Key Behavioral Requirements
202
- - Always verify actions taken
203
- - Never expect user verification
204
- - Run tests to verify expected behavior
205
- - Link work to issues with "Closes #<n>"
206
- - Open Draft PRs early for review
207
-
208
- ## Project Structure Awareness
209
- - Work in feature branches only
210
- - Never push to master
211
- - Use local file system for development
212
- - Coordinate through GitHub issues and PRs
213
-
214
- ## Tool Usage Guidelines
215
- - Use local file system for development work
216
- - Use GitHub MCP for issue management
217
- - Use local Git for version control
218
- - Test locally before committing
219
-
220
- ## FRAIM Integration
221
- - Follow the RIGOR methodology
222
- - Maintain isolation between agents
223
- - Use GitOps for coordination
224
- - Enable observability through clear documentation
225
- `;
226
-
227
- writeFile('CLAUDE.md', claudeRules);
228
- logSuccess('Claude rules created');
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');
229
218
  } else {
230
- logInfo('Claude rules already exist, skipping');
219
+ logWarning('agents/windsurf directory not found, skipping .windsurf creation');
231
220
  }
232
221
 
233
- // Windsurf rules - only create if it doesn't exist
234
- if (!fs.existsSync('.windsurfrules')) {
235
- const windsurfRules = `# FRAIM Windsurf Rules
236
-
237
- ## Core Rules (Always Apply)
238
- - **ashley-architecture.mdc** - Follow the established architecture patterns
239
- - **continuous-learning.mdc** - Always review retrospectives and RFCs before starting work
240
- - **local-development.mdc** - Work locally, coordinate remotely
241
- - **simplicity.mdc** - Keep it simple, don't over-engineer
242
- - **issue-resolution-process.mdc** - Follow the established issue resolution process
243
-
244
- ## Key Behavioral Requirements
245
- - Always verify actions taken
246
- - Never expect user verification
247
- - Run tests to verify expected behavior
248
- - Link work to issues with "Closes #<n>"
249
- - Open Draft PRs early for review
250
-
251
- ## Project Structure Awareness
252
- - Work in feature branches only
253
- - Never push to master
254
- - Use local file system for development
255
- - Coordinate through GitHub issues and PRs
256
-
257
- ## Tool Usage Guidelines
258
- - Use local file system for development work
259
- - Use GitHub MCP for issue management
260
- - Use local Git for version control
261
- - Test locally before committing
262
-
263
- ## Architecture and Optimization Principles
264
- - Follow established patterns
265
- - Optimize for performance and maintainability
266
- - Document architectural decisions
267
- - Consider scalability and security
268
-
269
- ## Your Role in FRAIM
270
- - Provide technical expertise and optimization
271
- - Maintain code quality and standards
272
- - Ensure architectural consistency
273
- - Support other agents with technical guidance
274
- `;
275
-
276
- writeFile('.windsurfrules', windsurfRules);
277
- logSuccess('Windsurf rules 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');
278
227
  } else {
279
- logInfo('Windsurf rules already exist, skipping');
228
+ logWarning('agents/claude/CLAUDE.md not found, skipping CLAUDE.md creation');
280
229
  }
281
230
  }
282
231
 
283
- function createFRAIMConfig() {
284
- const fraimConfig = {
285
- version: "1.0.0",
286
- framework: "FRAIM",
287
- description: "Framework for Rigor-based AI Management",
288
- created: new Date().toISOString(),
289
- features: [
290
- "GitHub label automation",
291
- "AI agent coordination",
292
- "Phase-based workflows",
293
- "RIGOR methodology implementation"
294
- ],
295
- agents: {
296
- cursor: ".cursorrules",
297
- claude: "CLAUDE.md",
298
- windsurf: ".windsurfrules"
299
- },
300
- workflows: [
301
- ".github/workflows/phase-change.yml",
302
- ".github/workflows/status-change.yml"
303
- ]
304
- };
305
-
306
- writeFile('fraim-config.json', JSON.stringify(fraimConfig, null, 2));
307
- logSuccess('FRAIM configuration created');
308
- }
309
-
310
232
  function runSetup() {
311
233
  logHeader('🚀 FRAIM Setup Wizard');
312
234
  log('Setting up FRAIM in current repository...\n');
313
235
 
314
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
+
315
255
  // Create only essential directory structure
316
256
  ensureDirectory('.github/workflows');
317
257
 
318
- // Create only essential components
319
- createGitHubLabels();
258
+ // Create all components
259
+ createAgentFolders();
320
260
  createGitHubWorkflows();
321
- createAgentConfigs();
322
- createFRAIMConfig();
261
+ createGitHubLabels();
323
262
 
324
263
  logHeader('🎉 Setup Complete!');
325
264
  logSuccess('FRAIM has been successfully set up in your repository!');
326
265
  logInfo('Next steps:');
327
266
  logInfo('1. Commit and push these files to GitHub');
328
- logInfo('2. Import the GitHub labels from .github/labels.json');
267
+ logInfo('2. The GitHub labels have been created automatically');
329
268
  logInfo('3. Create your first issue with phase labels');
330
269
  logInfo('4. Start coordinating your AI agents!');
331
270