|
19 | 19 | # FRAI · Framework of Responsible Artificial Intelligence |
20 | 20 |
|
21 | 21 |  |
| 22 | + |
| 23 | + |
22 | 24 |
|
23 | 25 | FRAI (Framework of Responsible Artificial Intelligence) is an open-source toolkit that helps any team — from solo developers to compliance officers — ship AI features responsibly. It walks you through quick questions, scans your code, and generates documentation you can actually hand to stakeholders: implementation checklists, model cards, risk files, evaluation reports, and policy-aware RAG indexes. |
24 | 26 |
|
@@ -99,14 +101,57 @@ frai eval --outputs runs/outputs.json --references runs/golden.json --report rep |
99 | 101 | - **Compliance-aware RAG**: Build vector stores from policies for knowledge-grounded guardrails |
100 | 102 | - **Evaluation harness**: Run baseline metrics and capture auditable reports |
101 | 103 |
|
102 | | -### Monorepo Layout |
| 104 | +### Package Architecture |
| 105 | + |
| 106 | +FRAI uses a **monorepo structure** with two separate npm packages for optimal flexibility and reusability: |
| 107 | + |
| 108 | +#### 📦 `frai-cli` (Main CLI Tool) |
| 109 | +- **Purpose**: Command-line interface for end users |
| 110 | +- **Published as**: `npm install -g frai` |
| 111 | +- **Contains**: CLI commands, user interface, documentation generators |
| 112 | +- **Depends on**: `frai-core@^0.0.1` |
| 113 | + |
| 114 | +#### 📦 `frai-core` (Core Library) |
| 115 | +- **Purpose**: Reusable services and utilities |
| 116 | +- **Published as**: `npm install frai-core` |
| 117 | +- **Contains**: Configuration, questionnaires, document generators, scanners, RAG, evaluation |
| 118 | +- **Used by**: CLI and potentially other tools/projects |
| 119 | + |
| 120 | +#### Why Two Packages? 🤔 |
| 121 | + |
| 122 | +**✅ Benefits of Separate Publishing:** |
| 123 | +- **Independent versioning**: Core can evolve without breaking CLI compatibility |
| 124 | +- **Reusability**: Other developers can use `frai-core` in their own tools |
| 125 | +- **Smaller packages**: Users only download what they need |
| 126 | +- **Better dependency management**: Clear API boundaries and contracts |
| 127 | +- **Ecosystem growth**: Core can be used in SDKs, plugins, web interfaces |
| 128 | + |
| 129 | +**❌ Problems with Single Package:** |
| 130 | +- **Bloat**: CLI users download core dependencies they don't need |
| 131 | +- **Coupling**: Everything tied to single version number |
| 132 | +- **Limited reuse**: Hard for other projects to use just the core functionality |
| 133 | +- **Maintenance complexity**: One change affects entire ecosystem |
| 134 | + |
| 135 | +**This is industry standard!** Examples: |
| 136 | +- React has `react` + `react-dom` + `@types/react` |
| 137 | +- Vue has `vue` + `@vue/compiler-sfc` |
| 138 | +- Webpack has many `@webpack/*` scoped packages |
| 139 | + |
| 140 | +#### Monorepo Layout |
103 | 141 |
|
104 | 142 | ``` |
105 | 143 | frai/ |
106 | 144 | ├─ packages/ |
107 | | -│ ├─ frai-cli/ # CLI entry point and command wiring |
108 | | -│ └─ frai-core/ # Reusable services (config, questionnaire, documents, scanners, RAG, eval) |
109 | | -├─ docs/ # Roadmaps, design notes, and feature backlogs |
| 145 | +│ ├─ frai-cli/ # CLI package (published as 'frai') |
| 146 | +│ │ ├─ src/ # TypeScript source code |
| 147 | +│ │ ├─ dist/ # Compiled JavaScript (published) |
| 148 | +│ │ ├─ README.md # CLI documentation (published) |
| 149 | +│ │ └─ package.json |
| 150 | +│ └─ frai-core/ # Core library (published as 'frai-core') |
| 151 | +│ ├─ src/ # ES modules (published as-is) |
| 152 | +│ ├─ README.md # Library documentation (published) |
| 153 | +│ └─ package.json |
| 154 | +├─ docs/ # Roadmaps, design notes, feature backlogs |
110 | 155 | └─ examples/ # Sample AI projects used in tests and demos |
111 | 156 | ``` |
112 | 157 |
|
@@ -152,11 +197,75 @@ frai --setup |
152 | 197 |
|
153 | 198 | --- |
154 | 199 |
|
| 200 | +## 🚀 Publishing & Deployment |
| 201 | + |
| 202 | +FRAI uses a monorepo with two separate npm packages that need to be published independently. |
| 203 | + |
| 204 | +### Publishing Process |
| 205 | + |
| 206 | +**1. Update versions in package.json files:** |
| 207 | +```bash |
| 208 | +# Update CLI version (in packages/frai-cli/package.json) |
| 209 | +# Update Core version (in packages/frai-core/package.json) |
| 210 | +``` |
| 211 | + |
| 212 | +**2. Build the CLI package:** |
| 213 | +```bash |
| 214 | +cd packages/frai-cli |
| 215 | +pnpm build # Compiles TypeScript to dist/ |
| 216 | +``` |
| 217 | + |
| 218 | +**3. Publish both packages:** |
| 219 | +```bash |
| 220 | +# Publish core first (CLI depends on it) |
| 221 | +cd packages/frai-core |
| 222 | +npm publish |
| 223 | + |
| 224 | +# Then publish CLI |
| 225 | +cd packages/frai-cli |
| 226 | +npm publish |
| 227 | +``` |
| 228 | + |
| 229 | +**4. Verify publication:** |
| 230 | +```bash |
| 231 | +npm view frai versions --json |
| 232 | +npm view frai-core versions --json |
| 233 | +``` |
| 234 | + |
| 235 | +### Package Publishing Order |
| 236 | + |
| 237 | +**Important:** Always publish `frai-core` first, then `frai-cli` because: |
| 238 | +- CLI depends on the specific core version |
| 239 | +- npm needs the core package to exist before CLI can reference it |
| 240 | +- This ensures dependency resolution works correctly |
| 241 | + |
| 242 | +### Version Management |
| 243 | + |
| 244 | +- **frai-core**: Library package, can evolve independently |
| 245 | +- **frai-cli**: Application package, depends on specific core version |
| 246 | +- **Semantic versioning**: Use appropriate version bumps based on changes |
| 247 | + |
| 248 | +### Publishing Checklist |
| 249 | + |
| 250 | +- [ ] Update version numbers in both package.json files |
| 251 | +- [ ] Update CLI dependency to reference published core version (not workspace:*) |
| 252 | +- [ ] Run tests: `pnpm test` |
| 253 | +- [ ] Build CLI: `cd packages/frai-cli && pnpm build` |
| 254 | +- [ ] Commit all changes with descriptive message |
| 255 | +- [ ] Publish frai-core first: `cd packages/frai-core && npm publish` |
| 256 | +- [ ] Publish frai-cli: `cd packages/frai-cli && npm publish` |
| 257 | +- [ ] Verify both packages appear correctly on npmjs.com |
| 258 | +- [ ] Test installation: `npm install -g frai` |
| 259 | + |
| 260 | +--- |
| 261 | + |
155 | 262 | ## 📖 Learn More |
156 | 263 | - [GitHub Repository](https://github.com/sebastianbuzdugan/frai) |
157 | | -- [NPM Package](https://www.npmjs.com/package/frai) |
| 264 | +- [CLI Package (frai)](https://www.npmjs.com/package/frai) - Main CLI tool |
| 265 | +- [Core Package (frai-core)](https://www.npmjs.com/package/frai-core) - Reusable library |
158 | 266 | - [AI Feature Backlog](docs/ai_feature_backlog.md) |
159 | 267 | - [Evaluation Harness Design](docs/eval_harness_design.md) |
| 268 | +- [Monorepo Architecture](docs/architecture-target.md) |
160 | 269 |
|
161 | 270 | --- |
162 | 271 |
|
|
0 commit comments