@friggframework/devtools 2.0.0--canary.474.b510a6e.0 → 2.0.0--canary.474.2ad4ebc.0
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.
- package/frigg-cli/{CLI.md → README.md} +99 -0
- package/infrastructure/HEALTH.md +468 -0
- package/package.json +6 -6
- package/FRIGG_DOCTOR_USAGE.md +0 -217
- package/TDD_PROOF.md +0 -254
- package/frigg-cli/CLI_PACKAGE_SEPARATION.md +0 -416
- package/infrastructure/MULTI_CLOUD_ARCHITECTURE.md +0 -703
|
@@ -1,416 +0,0 @@
|
|
|
1
|
-
# Frigg CLI Package Separation
|
|
2
|
-
|
|
3
|
-
**Implementation Date:** October 26, 2025
|
|
4
|
-
**Status:** ✅ Complete and Tested
|
|
5
|
-
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
## 🎯 Objective
|
|
9
|
-
|
|
10
|
-
Separate the Frigg CLI into a standalone globally-installable npm package that:
|
|
11
|
-
- Can be installed globally via `npm i -g @friggframework/frigg-cli`
|
|
12
|
-
- Uses the local project's `@friggframework/core` and `@friggframework/devtools` dependencies
|
|
13
|
-
- Automatically prefers local CLI installation if it's newer or equal version
|
|
14
|
-
- Warns about version mismatches between global and local installations
|
|
15
|
-
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
## 📦 Package Structure Changes
|
|
19
|
-
|
|
20
|
-
### Before
|
|
21
|
-
|
|
22
|
-
```
|
|
23
|
-
@friggframework/devtools
|
|
24
|
-
├── package.json (bin: "frigg": "./frigg-cli/index.js")
|
|
25
|
-
├── frigg-cli/
|
|
26
|
-
│ ├── package.json (workspace:* dependencies)
|
|
27
|
-
│ └── index.js
|
|
28
|
-
└── infrastructure/
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
**Problems:**
|
|
32
|
-
- Installing `@friggframework/devtools` globally installed the entire devtools package
|
|
33
|
-
- `workspace:*` dependencies don't resolve in global installs
|
|
34
|
-
- No version detection or preference for local installations
|
|
35
|
-
|
|
36
|
-
### After
|
|
37
|
-
|
|
38
|
-
```
|
|
39
|
-
@friggframework/frigg-cli (standalone package)
|
|
40
|
-
├── package.json
|
|
41
|
-
│ ├── dependencies: @friggframework/core@^2.0.0-next.0
|
|
42
|
-
│ ├── dependencies: @friggframework/devtools@^2.0.0-next.0
|
|
43
|
-
│ └── publishConfig: { access: "public" }
|
|
44
|
-
└── index.js (with version detection wrapper)
|
|
45
|
-
|
|
46
|
-
@friggframework/devtools
|
|
47
|
-
├── package.json (NO bin entry)
|
|
48
|
-
└── infrastructure/
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
**Benefits:**
|
|
52
|
-
- Clean separation: CLI is its own package
|
|
53
|
-
- Proper version dependencies for npm publish
|
|
54
|
-
- Automatic local preference when available
|
|
55
|
-
- Version mismatch warnings
|
|
56
|
-
|
|
57
|
-
---
|
|
58
|
-
|
|
59
|
-
## 🔍 Version Detection Logic
|
|
60
|
-
|
|
61
|
-
### How It Works
|
|
62
|
-
|
|
63
|
-
When you run `frigg` (globally installed), the CLI:
|
|
64
|
-
|
|
65
|
-
1. **Checks for skip flag**
|
|
66
|
-
If `FRIGG_CLI_SKIP_VERSION_CHECK=true`, skips detection (prevents recursion)
|
|
67
|
-
|
|
68
|
-
2. **Looks for local installation**
|
|
69
|
-
Searches for `node_modules/@friggframework/frigg-cli` in current directory
|
|
70
|
-
|
|
71
|
-
3. **Compares versions**
|
|
72
|
-
Uses `semver.compare(localVersion, globalVersion)`
|
|
73
|
-
|
|
74
|
-
4. **Makes decision**:
|
|
75
|
-
- **Local ≥ Global**: Uses local CLI
|
|
76
|
-
```
|
|
77
|
-
Using local frigg-cli@2.1.0 (global: 2.0.0)
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
- **Global > Local**: Warns and uses global
|
|
81
|
-
```
|
|
82
|
-
⚠️ Version mismatch: global frigg-cli@2.1.0 is newer than local frigg-cli@2.0.0
|
|
83
|
-
Consider updating local version: npm install @friggframework/frigg-cli@latest
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
- **No local**: Uses global silently
|
|
87
|
-
|
|
88
|
-
### Code Implementation
|
|
89
|
-
|
|
90
|
-
```javascript
|
|
91
|
-
// packages/devtools/frigg-cli/index.js (lines 3-75)
|
|
92
|
-
|
|
93
|
-
(function versionDetection() {
|
|
94
|
-
// Skip if env var set (prevents recursion)
|
|
95
|
-
if (process.env.FRIGG_CLI_SKIP_VERSION_CHECK === 'true') {
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const localCliPath = path.join(cwd, 'node_modules', '@friggframework', 'frigg-cli');
|
|
100
|
-
const localVersion = /* read from local package.json */;
|
|
101
|
-
const globalVersion = require('./package.json').version;
|
|
102
|
-
|
|
103
|
-
const comparison = semver.compare(localVersion, globalVersion);
|
|
104
|
-
|
|
105
|
-
if (comparison >= 0) {
|
|
106
|
-
// Use local CLI via subprocess
|
|
107
|
-
const child = spawn(process.execPath, [localCliIndex, ...args], {
|
|
108
|
-
stdio: 'inherit',
|
|
109
|
-
env: {
|
|
110
|
-
...process.env,
|
|
111
|
-
FRIGG_CLI_SKIP_VERSION_CHECK: 'true',
|
|
112
|
-
},
|
|
113
|
-
});
|
|
114
|
-
// Exit after delegating to local
|
|
115
|
-
child.on('exit', (code) => process.exit(code));
|
|
116
|
-
} else {
|
|
117
|
-
// Warn about version mismatch
|
|
118
|
-
console.warn(`⚠️ Version mismatch: ...`);
|
|
119
|
-
}
|
|
120
|
-
})();
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
---
|
|
124
|
-
|
|
125
|
-
## 🧪 Test Coverage
|
|
126
|
-
|
|
127
|
-
**Test File:** `__tests__/unit/version-detection.test.js`
|
|
128
|
-
|
|
129
|
-
**Results:** ✅ 15/15 tests passing
|
|
130
|
-
|
|
131
|
-
### Test Categories
|
|
132
|
-
|
|
133
|
-
1. **Semver Comparison** (5 tests)
|
|
134
|
-
- Local newer than global → prefer local
|
|
135
|
-
- Local equal to global → prefer local
|
|
136
|
-
- Global newer than local → warn and use global
|
|
137
|
-
- Prerelease version handling
|
|
138
|
-
- Release vs prerelease preference
|
|
139
|
-
|
|
140
|
-
2. **Local CLI Detection** (2 tests)
|
|
141
|
-
- Path construction for node_modules lookup
|
|
142
|
-
- package.json and index.js path validation
|
|
143
|
-
|
|
144
|
-
3. **Environment Variable Check** (2 tests)
|
|
145
|
-
- Skip detection when `FRIGG_CLI_SKIP_VERSION_CHECK=true`
|
|
146
|
-
- Don't skip when env var not set
|
|
147
|
-
|
|
148
|
-
4. **Decision Matrix** (4 tests)
|
|
149
|
-
- All version comparison scenarios
|
|
150
|
-
- Expected behavior verification
|
|
151
|
-
|
|
152
|
-
5. **Argument Forwarding** (2 tests)
|
|
153
|
-
- Extract args from process.argv correctly
|
|
154
|
-
- Forward all args to local CLI
|
|
155
|
-
|
|
156
|
-
---
|
|
157
|
-
|
|
158
|
-
## 📋 Installation & Usage
|
|
159
|
-
|
|
160
|
-
### Global Installation
|
|
161
|
-
|
|
162
|
-
```bash
|
|
163
|
-
# Install globally
|
|
164
|
-
npm install -g @friggframework/frigg-cli
|
|
165
|
-
|
|
166
|
-
# Verify installation
|
|
167
|
-
frigg --version
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
### Local Project Setup
|
|
171
|
-
|
|
172
|
-
```bash
|
|
173
|
-
# In your Frigg project
|
|
174
|
-
npm install @friggframework/core @friggframework/devtools @friggframework/frigg-cli
|
|
175
|
-
|
|
176
|
-
# The global CLI will automatically prefer this local version
|
|
177
|
-
frigg doctor my-stack
|
|
178
|
-
# Output: Using local frigg-cli@2.0.0 (global: 2.0.0)
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
### Version Management
|
|
182
|
-
|
|
183
|
-
**Scenario 1: Local and Global Same Version**
|
|
184
|
-
```bash
|
|
185
|
-
$ frigg doctor my-stack
|
|
186
|
-
Using local frigg-cli@2.0.0 (global: 2.0.0)
|
|
187
|
-
# Uses local installation
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
**Scenario 2: Local Newer Than Global**
|
|
191
|
-
```bash
|
|
192
|
-
$ frigg doctor my-stack
|
|
193
|
-
Using local frigg-cli@2.1.0 (global: 2.0.0)
|
|
194
|
-
# Uses local installation (preferred)
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
**Scenario 3: Global Newer Than Local**
|
|
198
|
-
```bash
|
|
199
|
-
$ frigg doctor my-stack
|
|
200
|
-
⚠️ Version mismatch: global frigg-cli@2.1.0 is newer than local frigg-cli@2.0.0
|
|
201
|
-
Consider updating local version: npm install @friggframework/frigg-cli@latest
|
|
202
|
-
# Uses global installation with warning
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
**Scenario 4: No Local Installation**
|
|
206
|
-
```bash
|
|
207
|
-
$ frigg doctor my-stack
|
|
208
|
-
# Uses global installation silently
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
---
|
|
212
|
-
|
|
213
|
-
## 🔧 Package Configuration
|
|
214
|
-
|
|
215
|
-
### frigg-cli/package.json
|
|
216
|
-
|
|
217
|
-
```json
|
|
218
|
-
{
|
|
219
|
-
"name": "@friggframework/frigg-cli",
|
|
220
|
-
"version": "2.0.0-next.0",
|
|
221
|
-
"bin": {
|
|
222
|
-
"frigg": "./index.js"
|
|
223
|
-
},
|
|
224
|
-
"dependencies": {
|
|
225
|
-
"@friggframework/core": "^2.0.0-next.0",
|
|
226
|
-
"@friggframework/devtools": "^2.0.0-next.0",
|
|
227
|
-
"@friggframework/schemas": "^2.0.0-next.0",
|
|
228
|
-
"semver": "^7.6.0",
|
|
229
|
-
// ... other dependencies
|
|
230
|
-
},
|
|
231
|
-
"publishConfig": {
|
|
232
|
-
"access": "public"
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
**Key Changes:**
|
|
238
|
-
- ✅ Replaced `workspace:*` with concrete versions (`^2.0.0-next.0`)
|
|
239
|
-
- ✅ Added `@friggframework/devtools` as dependency
|
|
240
|
-
- ✅ Added `publishConfig` for public npm publishing
|
|
241
|
-
- ✅ Kept `semver` for version comparison logic
|
|
242
|
-
|
|
243
|
-
### devtools/package.json
|
|
244
|
-
|
|
245
|
-
```json
|
|
246
|
-
{
|
|
247
|
-
"name": "@friggframework/devtools",
|
|
248
|
-
"version": "2.0.0-next.0",
|
|
249
|
-
// ❌ Removed bin entry (was: "bin": { "frigg": "./frigg-cli/index.js" })
|
|
250
|
-
"dependencies": {
|
|
251
|
-
// ... AWS SDK, infrastructure dependencies
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
**Key Changes:**
|
|
257
|
-
- ❌ Removed `bin` entry (CLI is now in frigg-cli package)
|
|
258
|
-
- ✅ Devtools remains a dependency of frigg-cli
|
|
259
|
-
|
|
260
|
-
---
|
|
261
|
-
|
|
262
|
-
## 🚀 Publishing Workflow
|
|
263
|
-
|
|
264
|
-
### Step 1: Publish frigg-cli
|
|
265
|
-
|
|
266
|
-
```bash
|
|
267
|
-
cd packages/devtools/frigg-cli
|
|
268
|
-
npm version patch # or minor, major
|
|
269
|
-
npm publish
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
### Step 2: Update Local Projects
|
|
273
|
-
|
|
274
|
-
```bash
|
|
275
|
-
# In Frigg projects
|
|
276
|
-
npm install @friggframework/frigg-cli@latest
|
|
277
|
-
```
|
|
278
|
-
|
|
279
|
-
### Step 3: Update Global Installation
|
|
280
|
-
|
|
281
|
-
```bash
|
|
282
|
-
npm install -g @friggframework/frigg-cli@latest
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
---
|
|
286
|
-
|
|
287
|
-
## 🔄 Migration Path
|
|
288
|
-
|
|
289
|
-
### For Existing Users
|
|
290
|
-
|
|
291
|
-
**Before (using devtools):**
|
|
292
|
-
```bash
|
|
293
|
-
npm install -g @friggframework/devtools@canary
|
|
294
|
-
# Issues: Full devtools package, workspace:* errors
|
|
295
|
-
```
|
|
296
|
-
|
|
297
|
-
**After (using frigg-cli):**
|
|
298
|
-
```bash
|
|
299
|
-
# Step 1: Uninstall old global devtools
|
|
300
|
-
npm uninstall -g @friggframework/devtools
|
|
301
|
-
|
|
302
|
-
# Step 2: Install new global CLI
|
|
303
|
-
npm install -g @friggframework/frigg-cli
|
|
304
|
-
|
|
305
|
-
# Step 3: Update local project dependencies
|
|
306
|
-
npm install @friggframework/frigg-cli@latest
|
|
307
|
-
```
|
|
308
|
-
|
|
309
|
-
### For New Projects
|
|
310
|
-
|
|
311
|
-
```bash
|
|
312
|
-
# Global CLI (once per machine)
|
|
313
|
-
npm install -g @friggframework/frigg-cli
|
|
314
|
-
|
|
315
|
-
# Local project dependencies
|
|
316
|
-
npx create-frigg-app my-app
|
|
317
|
-
# (Will automatically include @friggframework/frigg-cli in package.json)
|
|
318
|
-
```
|
|
319
|
-
|
|
320
|
-
---
|
|
321
|
-
|
|
322
|
-
## 🐛 Troubleshooting
|
|
323
|
-
|
|
324
|
-
### Issue: "Cannot find module '@friggframework/devtools'"
|
|
325
|
-
|
|
326
|
-
**Cause:** Global CLI doesn't have devtools installed
|
|
327
|
-
**Fix:**
|
|
328
|
-
```bash
|
|
329
|
-
npm install -g @friggframework/frigg-cli@latest
|
|
330
|
-
```
|
|
331
|
-
|
|
332
|
-
### Issue: Always using global CLI despite newer local version
|
|
333
|
-
|
|
334
|
-
**Cause:** Version detection may be skipped
|
|
335
|
-
**Debug:**
|
|
336
|
-
```bash
|
|
337
|
-
# Check if env var is set
|
|
338
|
-
echo $FRIGG_CLI_SKIP_VERSION_CHECK
|
|
339
|
-
|
|
340
|
-
# Verify local installation exists
|
|
341
|
-
ls node_modules/@friggframework/frigg-cli/package.json
|
|
342
|
-
|
|
343
|
-
# Check versions
|
|
344
|
-
cat node_modules/@friggframework/frigg-cli/package.json | grep version
|
|
345
|
-
frigg --version
|
|
346
|
-
```
|
|
347
|
-
|
|
348
|
-
### Issue: Version mismatch warnings
|
|
349
|
-
|
|
350
|
-
**Cause:** Local version older than global
|
|
351
|
-
**Fix:**
|
|
352
|
-
```bash
|
|
353
|
-
npm install @friggframework/frigg-cli@latest
|
|
354
|
-
```
|
|
355
|
-
|
|
356
|
-
---
|
|
357
|
-
|
|
358
|
-
## 📊 Benefits Summary
|
|
359
|
-
|
|
360
|
-
| Aspect | Before | After |
|
|
361
|
-
|--------|--------|-------|
|
|
362
|
-
| **Global Install** | Full devtools package | Just CLI tool |
|
|
363
|
-
| **Dependencies** | workspace:* (broken) | Concrete versions |
|
|
364
|
-
| **Version Preference** | No detection | Automatic local preference |
|
|
365
|
-
| **Version Warnings** | None | Mismatch alerts |
|
|
366
|
-
| **Package Size** | Large (full devtools) | Smaller (CLI only) |
|
|
367
|
-
| **Publishability** | Issues with workspace deps | Clean npm publish |
|
|
368
|
-
|
|
369
|
-
---
|
|
370
|
-
|
|
371
|
-
## ✅ Verification Checklist
|
|
372
|
-
|
|
373
|
-
- [x] frigg-cli package.json has concrete version dependencies
|
|
374
|
-
- [x] frigg-cli package.json includes publishConfig
|
|
375
|
-
- [x] devtools package.json removed bin entry
|
|
376
|
-
- [x] Version detection logic implemented
|
|
377
|
-
- [x] Environment variable check prevents recursion
|
|
378
|
-
- [x] Semver comparison works correctly
|
|
379
|
-
- [x] 15 tests covering all scenarios
|
|
380
|
-
- [x] All tests passing
|
|
381
|
-
- [x] Documentation complete
|
|
382
|
-
|
|
383
|
-
---
|
|
384
|
-
|
|
385
|
-
## 🔮 Future Enhancements
|
|
386
|
-
|
|
387
|
-
1. **Automatic Update Prompts**
|
|
388
|
-
```bash
|
|
389
|
-
⚠️ New version available: 2.1.0 (current: 2.0.0)
|
|
390
|
-
Run: npm install -g @friggframework/frigg-cli@latest
|
|
391
|
-
```
|
|
392
|
-
|
|
393
|
-
2. **Configuration File Support**
|
|
394
|
-
```json
|
|
395
|
-
// .friggrc
|
|
396
|
-
{
|
|
397
|
-
"cli": {
|
|
398
|
-
"preferLocal": true,
|
|
399
|
-
"autoUpdate": false
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
```
|
|
403
|
-
|
|
404
|
-
3. **Telemetry for Version Usage**
|
|
405
|
-
- Track which versions are commonly used
|
|
406
|
-
- Identify when users need migration help
|
|
407
|
-
|
|
408
|
-
---
|
|
409
|
-
|
|
410
|
-
**Repository:** friggframework/frigg
|
|
411
|
-
**Package:** @friggframework/frigg-cli
|
|
412
|
-
**Status:** ✅ Ready for publish
|
|
413
|
-
|
|
414
|
-
🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
|
415
|
-
|
|
416
|
-
Co-Authored-By: Claude <noreply@anthropic.com>
|