fraim 2.0.100

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 (70) hide show
  1. package/README.md +445 -0
  2. package/bin/fraim.js +23 -0
  3. package/dist/src/cli/api/get-provider-client.js +41 -0
  4. package/dist/src/cli/api/provider-client.js +107 -0
  5. package/dist/src/cli/commands/add-ide.js +430 -0
  6. package/dist/src/cli/commands/add-provider.js +233 -0
  7. package/dist/src/cli/commands/doctor.js +149 -0
  8. package/dist/src/cli/commands/init-project.js +301 -0
  9. package/dist/src/cli/commands/list-overridable.js +184 -0
  10. package/dist/src/cli/commands/list.js +57 -0
  11. package/dist/src/cli/commands/login.js +84 -0
  12. package/dist/src/cli/commands/mcp.js +15 -0
  13. package/dist/src/cli/commands/migrate-project-fraim.js +42 -0
  14. package/dist/src/cli/commands/override.js +177 -0
  15. package/dist/src/cli/commands/setup.js +651 -0
  16. package/dist/src/cli/commands/sync.js +162 -0
  17. package/dist/src/cli/commands/test-mcp.js +171 -0
  18. package/dist/src/cli/doctor/check-runner.js +199 -0
  19. package/dist/src/cli/doctor/checks/global-setup-checks.js +220 -0
  20. package/dist/src/cli/doctor/checks/ide-config-checks.js +250 -0
  21. package/dist/src/cli/doctor/checks/mcp-connectivity-checks.js +381 -0
  22. package/dist/src/cli/doctor/checks/project-setup-checks.js +282 -0
  23. package/dist/src/cli/doctor/checks/scripts-checks.js +157 -0
  24. package/dist/src/cli/doctor/checks/workflow-checks.js +251 -0
  25. package/dist/src/cli/doctor/reporters/console-reporter.js +96 -0
  26. package/dist/src/cli/doctor/reporters/json-reporter.js +11 -0
  27. package/dist/src/cli/doctor/types.js +6 -0
  28. package/dist/src/cli/fraim.js +100 -0
  29. package/dist/src/cli/internal/device-flow-service.js +83 -0
  30. package/dist/src/cli/mcp/ide-formats.js +243 -0
  31. package/dist/src/cli/mcp/mcp-server-builder.js +48 -0
  32. package/dist/src/cli/mcp/mcp-server-registry.js +160 -0
  33. package/dist/src/cli/mcp/types.js +3 -0
  34. package/dist/src/cli/providers/local-provider-registry.js +166 -0
  35. package/dist/src/cli/providers/provider-registry.js +230 -0
  36. package/dist/src/cli/setup/auto-mcp-setup.js +331 -0
  37. package/dist/src/cli/setup/codex-local-config.js +37 -0
  38. package/dist/src/cli/setup/first-run.js +242 -0
  39. package/dist/src/cli/setup/ide-detector.js +179 -0
  40. package/dist/src/cli/setup/mcp-config-generator.js +192 -0
  41. package/dist/src/cli/setup/provider-prompts.js +339 -0
  42. package/dist/src/cli/utils/agent-adapters.js +126 -0
  43. package/dist/src/cli/utils/digest-utils.js +47 -0
  44. package/dist/src/cli/utils/fraim-gitignore.js +40 -0
  45. package/dist/src/cli/utils/platform-detection.js +258 -0
  46. package/dist/src/cli/utils/project-bootstrap.js +93 -0
  47. package/dist/src/cli/utils/remote-sync.js +315 -0
  48. package/dist/src/cli/utils/script-sync-utils.js +221 -0
  49. package/dist/src/cli/utils/version-utils.js +32 -0
  50. package/dist/src/core/ai-mentor.js +230 -0
  51. package/dist/src/core/config-loader.js +114 -0
  52. package/dist/src/core/config-writer.js +75 -0
  53. package/dist/src/core/types.js +23 -0
  54. package/dist/src/core/utils/git-utils.js +95 -0
  55. package/dist/src/core/utils/include-resolver.js +92 -0
  56. package/dist/src/core/utils/inheritance-parser.js +288 -0
  57. package/dist/src/core/utils/job-parser.js +176 -0
  58. package/dist/src/core/utils/local-registry-resolver.js +616 -0
  59. package/dist/src/core/utils/object-utils.js +11 -0
  60. package/dist/src/core/utils/project-fraim-migration.js +103 -0
  61. package/dist/src/core/utils/project-fraim-paths.js +38 -0
  62. package/dist/src/core/utils/provider-utils.js +18 -0
  63. package/dist/src/core/utils/server-startup.js +34 -0
  64. package/dist/src/core/utils/stub-generator.js +147 -0
  65. package/dist/src/core/utils/workflow-parser.js +174 -0
  66. package/dist/src/local-mcp-server/learning-context-builder.js +229 -0
  67. package/dist/src/local-mcp-server/stdio-server.js +1698 -0
  68. package/dist/src/local-mcp-server/usage-collector.js +264 -0
  69. package/index.js +85 -0
  70. package/package.json +139 -0
package/README.md ADDED
@@ -0,0 +1,445 @@
1
+ # 🚀 FRAIM: Framework for Rigor-based AI Management
2
+ **"FRAIM is a step towards the future of how we work."** - Transforming ideas into production code by converting you into an AI manager orchestrating multiple agents with enterprise-grade discipline.
3
+
4
+
5
+ 🚀 **The Problem with AI Coding Today**
6
+
7
+ Current "vibe coding" frameworks are great at getting from idea to prototype. They fail spectacularly at going from prototype to production or evolving complex codebases.
8
+
9
+ AI agents are like brilliant but inexperienced developers. They need:
10
+ • Clear guardrails to prevent costly mistakes
11
+ • Structured workflows to avoid chaos
12
+ • Evidence-based validation (not "looks good" claims)
13
+ • Learning systems to improve over time
14
+ • Balance between determinism and creativity
15
+
16
+ 🎯 **Introducing FRAIM: Framework for Rigor-based AI Management**
17
+
18
+ FRAIM transforms you from a solo developer into an AI manager orchestrating multiple agents with enterprise-grade discipline.
19
+
20
+ **The Transformation:**
21
+ ❌ Before: "It's working now. The login button exists."
22
+ ✅ After: "Implementation complete. 12/12 tests pass, API endpoint validated, UI screenshots provided."
23
+
24
+ **Real Results:**
25
+ • Dramatic reduction in AI-generated code that needs rework
26
+ • Faster delivery through structured workflows
27
+ • Higher test coverage through mandatory evidence collection
28
+ • Zero agent conflicts through phase-based coordination
29
+
30
+ **The RIGOR Methodology:**
31
+ R - Reviews: Structured feedback with evidence
32
+ I - Isolation: Agents don't interfere unless coordinated
33
+ G - GitOps: Git as single source of truth
34
+ O - Observability: Complete visibility into AI activities
35
+ R - Retrospectives: Continuous learning from experience
36
+
37
+ 🤖 **Works with any AI agent** (Cursor, Claude, Windsurf) - no vendor lock-in.
38
+
39
+ **The bottom line:** FRAIM isn't just about using AI—it's about managing AI teams with the same discipline you'd apply to human developers.
40
+
41
+
42
+
43
+ ### The Human-Developer Parallel
44
+
45
+ | **Human Development** | **AI Agent Development** | **FRAIM Solution** |
46
+ |----------------------|-------------------------|-------------------|
47
+ | **Code Reviews** | Random quality checks | Structured review workflows with evidence requirements |
48
+ | **Testing Standards** | "Looks good" claims | Mandatory test evidence with failure reproduction |
49
+ | **Team Coordination** | Agent conflicts and overlaps | Phase-based isolation with clear handoffs |
50
+ | **Learning Culture** | Repeated mistakes | Retrospective-driven improvement system |
51
+ | **Process Discipline** | Ad-hoc approaches | Proven workflows and deterministic scripts from real projects |
52
+ | **Quality Gates** | Unreliable outcomes | Deterministic validation with rollback capabilities |
53
+
54
+
55
+ ## 🔥 The Problems FRAIM Solves
56
+
57
+ ### ❌ **The Current State of AI Development**
58
+ - **"Looks Good" Syndrome**: Agents claim success without evidence
59
+ - **Quality Lottery**: Inconsistent code quality and reliability
60
+ - **Agent Chaos**: Multiple agents stepping on each other's work
61
+ - **No Learning**: Repeated mistakes without improvement
62
+ - **Ad-hoc Processes**: Every project reinvents the wheel
63
+ - **False Confidence**: Broken code marked as "working"
64
+ - **Hanging Agents**: Commands that hang requiring human intervention
65
+ - **Lost Output**: No visibility into long-running task progress
66
+
67
+ ### ✅ **The FRAIM Solution**
68
+
69
+ #### 🛡️ **Agent Integrity & Test Ethics**
70
+ **Problem**: Agents claim "tests pass" when they actually fail
71
+ **Solution**: Mandatory evidence collection, test immutability rules, and accountability frameworks
72
+ ```bash
73
+ # Before FRAIM: "Tests look good!"
74
+ # After FRAIM: "Here's the test output proving all 47 tests pass"
75
+ ```
76
+
77
+ #### 🧪 **Comprehensive Testing Guidelines**
78
+ **Problem**: Superficial testing that misses real issues
79
+ **Solution**: Multi-layer validation (database, API, UI, integration) with mandatory evidence
80
+ ```bash
81
+ # Before: Mock everything, hope it works
82
+ # After: Test real systems, prove it works, show evidence
83
+ ```
84
+
85
+ #### 🗣️ **Clear Communication Standards**
86
+ **Problem**: Vague progress reports and unclear accountability
87
+ **Solution**: Structured progress updates with concrete evidence and absolute accountability
88
+ ```bash
89
+ # Before: "Working on it, almost done"
90
+ # After: "Fixed API timeout, tests passing, evidence attached, ready for review"
91
+ ```
92
+
93
+ #### 🏗️ **Architectural Discipline**
94
+ **Problem**: Agents create architectural chaos and technical debt
95
+ **Solution**: Clean separation of concerns, type safety, and testability patterns
96
+ ```bash
97
+ # Before: Spaghetti code with mixed responsibilities
98
+ # After: Clean layers with proper boundaries and validation
99
+ ```
100
+
101
+ #### 🎯 **Spike-First Development**
102
+ **Problem**: Agents build complex solutions without validating assumptions
103
+ **Solution**: 5-15 minute proof-of-concepts before major implementation
104
+ ```bash
105
+ # Before: Build 3-week solution, discover it doesn't work
106
+ # After: 10-minute spike, validate approach, then build confidently
107
+ ```
108
+
109
+ #### 🔄 **Continuous Learning System**
110
+ **Problem**: Same mistakes repeated across projects
111
+ **Solution**: Retrospective-driven knowledge capture and pattern recognition
112
+ ```bash
113
+ # Before: Every agent learns the same lessons from scratch
114
+ # After: Knowledge accumulates, patterns emerge, quality improves
115
+ ```
116
+
117
+ #### 🧹 **Simplicity Discipline**
118
+ **Problem**: Over-engineered solutions that are hard to maintain
119
+ **Solution**: "Keep it simple" principles with complexity budgets
120
+ ```bash
121
+ # Before: 500-line solution to a 10-line problem
122
+ # After: Minimal, focused solution that actually works
123
+ ```
124
+
125
+ #### 🔧 **Git Safety & Timeout Management**
126
+ **Problem**: Agents hang on interactive Git commands and long-running tasks, requiring human intervention
127
+ **Solution**: Safe Git commands and timeout scripts with output visibility
128
+ ```bash
129
+ # Before: Agent hangs on "git log" (opens pager) or tests run forever
130
+ # After: Non-interactive commands with timeouts and log files for visibility
131
+ # Example: exec-with-timeout.ts runs tests with timeout and saves output to files
132
+ ```
133
+
134
+ #### 🔄 **Merge Requirements & Branch Safety**
135
+ **Problem**: Agents accidentally overwrite master branch or create merge conflicts
136
+ **Solution**: Mandatory rebase workflows with conflict resolution patterns
137
+ ```bash
138
+ # Before: Force pushes that destroy other work
139
+ # After: Rebase-on-master with force-with-lease for safety
140
+ ```
141
+
142
+ #### 🐛 **Systematic Debugging Patterns**
143
+ **Problem**: Agents struggle with complex debugging and repeat the same mistakes
144
+ **Solution**: Structured debugging methodology with evidence collection and pattern recognition
145
+ ```bash
146
+ # Before: Random debugging attempts, no learning
147
+ # After: Systematic approach with documented patterns and regression tests
148
+ ```
149
+
150
+ #### 📋 **Package Scripts & Output Visibility**
151
+ **Problem**: Long-running tasks hang agents and provide no visibility into progress
152
+ **Solution**: Background execution with log files and timeout management
153
+ ```bash
154
+ # Before: "npm test" hangs agent, no output visibility
155
+ # After: "npm test" runs in background, saves to test.log, agent can observe progress
156
+ # Example: exec-with-timeout.ts prevents hangs and provides output visibility
157
+ ```
158
+
159
+ ## 🚀 **Proven Benefits from Real Projects**
160
+
161
+ - **Dramatic reduction** in AI-generated code that needs rework through evidence-based validation
162
+ - **Faster delivery** through structured workflows and clear handoffs
163
+ - **Higher test coverage** through mandatory testing guidelines and evidence collection
164
+ - **Zero agent conflicts** through phase-based isolation and coordination
165
+ - **Complete accountability** - agents fix their own mistakes with evidence
166
+
167
+ ## 🎬 **The FRAIM Experience: From Chaos to Clarity**
168
+
169
+ ### **Before FRAIM: Single Agent Chaos**
170
+ ```bash
171
+ # You: "Add user authentication to the app"
172
+ # Agent: "I'll add login functionality"
173
+ #
174
+ # 10 minutes later...
175
+ # Agent: "I've designed the UX to be modern and beautiful. What do you think?"
176
+ # You: "It's way too complex and does not work with the rest of the product. Just make it simple"
177
+ # Agent: "You are right. I've made it too complex, let me simplify it right now"
178
+ # You: "I've told you this 10 times already!!!! "
179
+ #
180
+ # 1 hour later...
181
+ # Agent: "Implementation complete. Solution looks good."
182
+ # You: "I get an error on the first screen."
183
+ # Agent: "What error do you see? Can you write it out for me or give me a screenshot?"
184
+ # You: "C'mon, do this yourself."
185
+ #
186
+ # 2 hours later...
187
+ # Agent: <Stuck waiting for a playwright test which hasn't relinquished control>
188
+ # You: "You've made no progress"
189
+ # Agent: "You are right. I keep getting stuck. Could you test the implementation for me?"
190
+ #
191
+ # 3 hours later...
192
+ # Agent: "Ok I'm all done, test cases are passing"
193
+ # You: "Wait, what... you changed existing tests to make them pass ... everything is broken!!"
194
+ ```
195
+
196
+ ### **After FRAIM: Single Agent Excellence**
197
+ ```bash
198
+ # You: "Add user authentication to the app"
199
+ # Agent: "Starting design phase. Creating RFC with UX mockups, validation rules, and API specs"
200
+ #
201
+ # 10 minutes later...
202
+ # Agent: "Design complete. UX mockups created, validation rules defined, API endpoints specified.
203
+ # Evidence: 3 mockup images, validation requirements document, API spec ready for review"
204
+ # You: "Looks good, proceed to implementation"
205
+ #
206
+ # 1 hour later...
207
+ # Agent: "Implementation complete. Code written, tests created, all tests passing.
208
+ # Evidence: Test output showing existing 120/120 tests pass, new 12/12 tests pass, API endpoint tested with curl,
209
+ # UI tested with screenshots showing login form and error states"
210
+ # During PR review...
211
+ # Reviewer: "Password validation is too strict"
212
+ # Agent: "Fixed password validation rules, updated tests, evidence provided.
213
+ # Evidence: New test output showing updated validation, UI screenshots with new rules"
214
+ #
215
+ # Result: In best case, hours of frustration, rework saved. In worst case, reputation saved from deploying broken code to production.
216
+ ```
217
+
218
+ ## 🏗️ **Enterprise-Grade Framework Structure**
219
+
220
+ ## 🚀 **Get Started in 60 Seconds**
221
+
222
+ ### **⚠️ Prerequisites**
223
+
224
+ **Shell Requirements:**
225
+ - **Windows**: Must use Git Bash (install from https://git-scm.com/download/win)
226
+ - **macOS/Linux**: Default terminal works fine
227
+
228
+ **Why Git Bash on Windows?** All FRAIM scripts use Unix-style paths and Bash commands. Git Bash ensures consistent behavior across platforms.
229
+
230
+ ### **Install & Initialize**
231
+
232
+ **Recommended: Use npx (no installation needed)**
233
+ ```bash
234
+ npx fraim-framework@latest setup --key=<your-fraim-key>
235
+
236
+ # Optional: Create alias for convenience
237
+ echo 'alias fraim="npx fraim-framework"' >> ~/.bashrc
238
+ source ~/.bashrc
239
+ ```
240
+
241
+ **Alternative: Global install**
242
+ ```bash
243
+ npm install -g fraim-framework
244
+ fraim setup --key=<your-fraim-key>
245
+ ```
246
+
247
+ > **💡 Why npx?** Works with any Node version (16+), no conflicts when switching Node versions, always uses correct dependencies, and identical functionality to global install. Perfect for users with nvm, volta, or multiple Node versions.
248
+
249
+ The setup command supports three modes:
250
+
251
+ **Conversational Mode**: AI workflows only, no platform integration required
252
+ ```bash
253
+ fraim setup --key=<your-fraim-key>
254
+ # Select "Conversational Mode" when prompted
255
+ ```
256
+
257
+ **Integrated Mode**: Single platform for both code hosting and issue tracking
258
+ ```bash
259
+ fraim setup --key=<your-fraim-key>
260
+ # Select "Integrated Mode" when prompted
261
+ # Choose platform: GitHub, Azure DevOps, or GitLab
262
+ ```
263
+
264
+ **Split Mode**: Separate platforms for code hosting and issue tracking
265
+ ```bash
266
+ fraim setup --key=<your-fraim-key>
267
+ # Select "Split Mode" when prompted
268
+ # Choose code repository platform: GitHub, Azure DevOps, or GitLab
269
+ # Choose issue tracking platform: GitHub, Azure DevOps, GitLab, or Jira
270
+ ```
271
+
272
+ Common Split mode combinations:
273
+ - GitHub (code) + Jira (issues)
274
+ - GitLab (code) + Jira (issues)
275
+ - Azure DevOps (code) + GitHub (issues)
276
+
277
+ ### **🔧 Additional Commands**
278
+
279
+ After initial setup, you can use these commands:
280
+
281
+ ```bash
282
+ # Add FRAIM to additional IDEs (after initial setup)
283
+ fraim add-ide --ide claude # Configure specific IDE
284
+ fraim add-ide --ide antigravity # Configure Gemini Antigravity
285
+ fraim add-ide --all # Configure all detected IDEs
286
+ fraim add-ide --list # List supported IDEs
287
+
288
+ # Add platform integrations to existing setup
289
+ fraim setup --github # Add GitHub integration
290
+ fraim setup --ado # Add Azure DevOps integration
291
+ fraim setup --gitlab # Add GitLab integration
292
+ fraim setup --jira # Add Jira integration
293
+
294
+ # Project initialization
295
+ fraim init-project # Initialize FRAIM in current project
296
+
297
+ # Testing and validation
298
+ fraim doctor --test-mcp # Test MCP server connections
299
+ fraim doctor # Diagnose configuration issues
300
+
301
+ # Sync and maintenance
302
+ fraim sync # Sync latest workflows and rules
303
+ ```
304
+
305
+ **💡 Pro Tip**: Use `fraim add-ide` when you install a new IDE after initial setup. It reuses your existing FRAIM and platform tokens, making it much faster than running full setup again.
306
+
307
+ ### **🧩 Personalized Jobs, Skills, and Rules**
308
+
309
+ Project-specific customization now lives under `.fraim/personalized-employee/`.
310
+
311
+ Recommended layout:
312
+
313
+ ```text
314
+ .fraim/
315
+ personalized-employee/
316
+ jobs/
317
+ skills/
318
+ rules/
319
+ templates/
320
+ ```
321
+
322
+ Use `fraim override` to create a local starting point:
323
+
324
+ ```bash
325
+ fraim override --inherit jobs/product-building/feature-implementation.md
326
+ fraim override --copy rules/engineering/architecture-standards.md
327
+ ```
328
+
329
+ Guidance:
330
+ - Put phased job customizations in `.fraim/personalized-employee/jobs/...`
331
+ - Put reusable local capability snippets in `.fraim/personalized-employee/skills/...`
332
+ - Put broad team conventions in `.fraim/personalized-employee/rules/...`
333
+ - Put local deliverable tweaks in `.fraim/personalized-employee/templates/...`
334
+ - Do not edit synced content under `.fraim/ai-employee/` or `.fraim/ai-manager/`; `fraim sync` will overwrite it
335
+ - Legacy `.fraim/overrides/` is still read for compatibility, but new work should go in `.fraim/personalized-employee/`
336
+
337
+ ### **🔧 Jira Integration Setup**
338
+
339
+ FRAIM uses the official Model Context Protocol (MCP) server for Jira integration. The setup command automatically configures the correct format.
340
+
341
+ **Jira API Token Requirements**:
342
+ 1. Go to https://id.atlassian.com/manage-profile/security/api-tokens
343
+ 2. Click "Create API token"
344
+ 3. Give it a name (e.g., "FRAIM Integration")
345
+ 4. Copy the token (starts with ATATT3...)
346
+ 5. Use this token during `fraim setup`
347
+
348
+ **Correct MCP Configuration** (automatically generated):
349
+ ```json
350
+ {
351
+ "jira": {
352
+ "command": "uvx",
353
+ "args": ["mcp-atlassian"],
354
+ "env": {
355
+ "JIRA_URL": "https://mycompany.atlassian.net",
356
+ "JIRA_USERNAME": "user@mycompany.com",
357
+ "JIRA_API_TOKEN": "your-token-here"
358
+ }
359
+ }
360
+ }
361
+ ```
362
+
363
+ **⚠️ Common Issues**:
364
+ - **Old package name**: If you see `@modelcontextprotocol/server-jira` in your config, this package doesn't exist. Run `fraim setup --jira` to update to the correct `mcp-atlassian` package.
365
+ - **Token format**: Jira API tokens typically start with `ATATT3`. If your token doesn't match this format, verify you created an API token (not a personal access token).
366
+ - **First run slow**: The first time `uvx` runs the Jira MCP server, it downloads the package. This is normal and only happens once.
367
+
368
+ **Troubleshooting**:
369
+ ```bash
370
+ # Test Jira MCP connection
371
+ fraim doctor --test-mcp
372
+
373
+ # Reconfigure Jira integration
374
+ fraim setup --jira
375
+
376
+ # Check configuration
377
+ cat ~/.kiro/settings/mcp.json # For Kiro IDE
378
+ cat ~/Library/Application\ Support/Claude/claude_desktop_config.json # For Claude Desktop (macOS)
379
+ ```
380
+
381
+
382
+ ## 🌟 **Why FRAIM is the Future**
383
+
384
+ ### **1. Proven in Production**
385
+ Every rule, workflow, and pattern has been tested in real projects. This isn't theoretical—it's battle-tested.
386
+
387
+ ### **2. Enterprise Discipline**
388
+ The same rigor you'd apply to managing human developers, applied to AI agents.
389
+
390
+ ### **3. Continuous Improvement**
391
+ Built-in learning systems that make your AI agents better over time.
392
+
393
+ ### **4. Complete Transparency**
394
+ Full visibility into what each agent is doing, with evidence-based validation.
395
+
396
+ ### **5. Zero Vendor Lock-in**
397
+ Works with any AI agent (Cursor, Claude, Windsurf, future agents).
398
+
399
+
400
+ ## 🚀 **Ready to Transform Your Development?**
401
+
402
+ ### **Start Your AI Management Journey**
403
+
404
+ ```bash
405
+ # Watch the magic happen
406
+ gh issue create --title "Add API rate limiting" --label "phase:design"
407
+ # → Agent: "RFC created, architecture validated, ready for implementation"
408
+
409
+ gh issue edit 123 --remove-label "phase:design" --add-label "phase:impl"
410
+ # → Agent: "Implementation complete, tests passing, evidence provided"
411
+
412
+ gh issue edit 123 --remove-label "phase:impl" --add-label "phase:tests"
413
+ # → Agent: "Performance validated, security checked, ready for production"
414
+
415
+ # Result: Production-ready feature in 2 hours instead of 2 days
416
+ ```
417
+
418
+
419
+
420
+ ### **Join the Future of Development**
421
+
422
+ - 🌟 [**GitHub Repository**](https://github.com/mathursrus/FRAIM) - Star us to follow development
423
+ - 🐛 [**Issue Tracker**](https://github.com/mathursrus/FRAIM/issues) - Report bugs or request features
424
+
425
+ ---
426
+
427
+ ## 🎯 **The Bottom Line**
428
+
429
+ **FRAIM isn't just about using AI—it's about managing AI teams with the same discipline you'd apply to human teams.**
430
+
431
+ Stop fighting with AI agents. Start orchestrating them.
432
+
433
+ **This is the future of how we work.**
434
+
435
+ ---
436
+
437
+ <div align="center">
438
+
439
+ **🚀 Ready to become an AI manager? Start with FRAIM today.**
440
+
441
+ [![npm version](https://img.shields.io/npm/v/fraim-framework.svg)](https://www.npmjs.com/package/fraim-framework)
442
+ [![GitHub stars](https://img.shields.io/github/stars/mathursrus/FRAIM.svg)](https://github.com/mathursrus/FRAIM/stargazers)
443
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
444
+
445
+ </div>
package/bin/fraim.js ADDED
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * FRAIM Framework CLI Entry Point
5
+ *
6
+ * This file delegates to the compiled TypeScript implementation.
7
+ */
8
+
9
+ try {
10
+ // In production/installed package, code is in dist/
11
+ require('../dist/src/cli/fraim.js');
12
+ } catch (error) {
13
+ if (error.code === 'MODULE_NOT_FOUND') {
14
+ // In development (local clone), we might use tsx if dist is missing
15
+ // But typically we should just tell user to build.
16
+ console.error('❌ Could not find FRAIM CLI implementation.');
17
+ console.error(' If you are running from source, please run "npm run build" first.');
18
+ console.error(` Error details: ${error.message}`);
19
+ process.exit(1);
20
+ } else {
21
+ throw error;
22
+ }
23
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getProviderClient = getProviderClient;
7
+ // Helper to get provider client with FRAIM key from config
8
+ const provider_client_1 = require("./provider-client");
9
+ const fs_1 = __importDefault(require("fs"));
10
+ const path_1 = __importDefault(require("path"));
11
+ const os_1 = __importDefault(require("os"));
12
+ /**
13
+ * Get user FRAIM directory
14
+ */
15
+ function getUserFraimDir() {
16
+ return process.env.FRAIM_USER_DIR || path_1.default.join(os_1.default.homedir(), '.fraim');
17
+ }
18
+ /**
19
+ * Get provider client using FRAIM key from global config
20
+ * Throws error if no config found - caller should handle and use local fallback
21
+ */
22
+ function getProviderClient() {
23
+ const globalConfigPath = path_1.default.join(getUserFraimDir(), 'config.json');
24
+ if (!fs_1.default.existsSync(globalConfigPath)) {
25
+ throw new Error('No FRAIM configuration found');
26
+ }
27
+ try {
28
+ const config = JSON.parse(fs_1.default.readFileSync(globalConfigPath, 'utf8'));
29
+ const fraimKey = config.apiKey;
30
+ if (!fraimKey) {
31
+ throw new Error('FRAIM API key not found in config');
32
+ }
33
+ // Use FRAIM_REMOTE_URL if set (for tests or custom deployments)
34
+ // Otherwise ProviderClient will use its default
35
+ const serverUrl = process.env.FRAIM_REMOTE_URL || undefined;
36
+ return new provider_client_1.ProviderClient(fraimKey, serverUrl);
37
+ }
38
+ catch (error) {
39
+ throw new Error(`Failed to load FRAIM configuration: ${error.message}`);
40
+ }
41
+ }
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ProviderClient = void 0;
7
+ // CLI client for fetching provider metadata from server
8
+ const axios_1 = __importDefault(require("axios"));
9
+ class ProviderClient {
10
+ constructor(fraimKey, serverUrl) {
11
+ this.serverUrl = serverUrl || process.env.FRAIM_REMOTE_URL || 'https://fraim.wellnessatwork.me';
12
+ this.client = axios_1.default.create({
13
+ baseURL: this.serverUrl,
14
+ headers: {
15
+ 'x-api-key': fraimKey,
16
+ 'Content-Type': 'application/json'
17
+ },
18
+ timeout: 10000 // 10 second timeout
19
+ });
20
+ }
21
+ /**
22
+ * Get all providers from server
23
+ */
24
+ async getAllProviders() {
25
+ try {
26
+ const response = await this.client.get('/api/providers');
27
+ return response.data.providers;
28
+ }
29
+ catch (error) {
30
+ if (error.response) {
31
+ // Server responded with error status
32
+ throw new Error(`Failed to fetch providers: ${error.response.status} - ${JSON.stringify(error.response.data)}`);
33
+ }
34
+ else if (error.request) {
35
+ // Request was made but no response
36
+ throw new Error(`Failed to fetch providers: No response from server`);
37
+ }
38
+ else {
39
+ // Something else happened
40
+ throw new Error(`Failed to fetch providers: ${error.message}`);
41
+ }
42
+ }
43
+ }
44
+ /**
45
+ * Get a specific provider by ID
46
+ */
47
+ async getProvider(id) {
48
+ const providers = await this.getAllProviders();
49
+ return providers.find(p => p.id === id) || null;
50
+ }
51
+ /**
52
+ * Get provider config schema
53
+ */
54
+ async getProviderSchema(id) {
55
+ try {
56
+ const response = await this.client.get(`/api/providers/${id}/schema`);
57
+ return response.data;
58
+ }
59
+ catch (error) {
60
+ if (error.response?.status === 404) {
61
+ throw new Error(`Provider '${id}' not found`);
62
+ }
63
+ throw new Error(`Failed to fetch provider schema: ${error.message}`);
64
+ }
65
+ }
66
+ /**
67
+ * Validate provider config
68
+ */
69
+ async validateProviderConfig(id, config) {
70
+ try {
71
+ const response = await this.client.post(`/api/providers/${id}/validate`, config);
72
+ return response.data;
73
+ }
74
+ catch (error) {
75
+ throw new Error(`Failed to validate provider config: ${error.message}`);
76
+ }
77
+ }
78
+ /**
79
+ * Get all provider IDs
80
+ */
81
+ async getAllProviderIds() {
82
+ const providers = await this.getAllProviders();
83
+ return providers.map(p => p.id);
84
+ }
85
+ /**
86
+ * Get providers with a specific capability
87
+ */
88
+ async getProvidersWithCapability(capability) {
89
+ const providers = await this.getAllProviders();
90
+ return providers.filter(p => p.capabilities.includes(capability));
91
+ }
92
+ /**
93
+ * Check if a provider has a specific capability
94
+ */
95
+ async providerHasCapability(providerId, capability) {
96
+ const provider = await this.getProvider(providerId);
97
+ return provider ? provider.capabilities.includes(capability) : false;
98
+ }
99
+ /**
100
+ * Check if provider requires additional config
101
+ */
102
+ async requiresAdditionalConfig(providerId) {
103
+ const provider = await this.getProvider(providerId);
104
+ return provider?.hasAdditionalConfig || false;
105
+ }
106
+ }
107
+ exports.ProviderClient = ProviderClient;