vibefast-cli 0.1.1
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/FINAL-STATUS.md +144 -0
- package/HOW-IT-WORKS.md +559 -0
- package/PLAN.md +453 -0
- package/README.md +129 -0
- package/RECIPES-READY.md +172 -0
- package/STATUS.md +199 -0
- package/SUCCESS.md +259 -0
- package/TESTING-CHECKLIST.md +450 -0
- package/cloudflare-worker/.wrangler/state/v3/kv/64907821e2634080acce34618d2f3d4c/blobs/11f2769953c717e188062bc644da97c1fd1e4d6d0813a226ce7567dba759afab0000019a736fb8d4 +1 -0
- package/cloudflare-worker/.wrangler/state/v3/kv/miniflare-KVNamespaceObject/0b03767237c0408301af51ca35d4b09470cbc479c7e5f23cc9de774749d23c59.sqlite +0 -0
- package/cloudflare-worker/.wrangler/state/v3/kv/miniflare-KVNamespaceObject/0b03767237c0408301af51ca35d4b09470cbc479c7e5f23cc9de774749d23c59.sqlite-shm +0 -0
- package/cloudflare-worker/.wrangler/state/v3/kv/miniflare-KVNamespaceObject/0b03767237c0408301af51ca35d4b09470cbc479c7e5f23cc9de774749d23c59.sqlite-wal +0 -0
- package/cloudflare-worker/.wrangler/state/v3/r2/miniflare-R2BucketObject/d1cc388a1a0ef44dd5669fd1a165d168b61362136c8b5fa50aefd96c72688e54.sqlite +0 -0
- package/cloudflare-worker/.wrangler/state/v3/r2/miniflare-R2BucketObject/d1cc388a1a0ef44dd5669fd1a165d168b61362136c8b5fa50aefd96c72688e54.sqlite-shm +0 -0
- package/cloudflare-worker/.wrangler/state/v3/r2/miniflare-R2BucketObject/d1cc388a1a0ef44dd5669fd1a165d168b61362136c8b5fa50aefd96c72688e54.sqlite-wal +0 -0
- package/cloudflare-worker/.wrangler/state/v3/r2/vibefast-recipes/blobs/620e8cf7c35d9806da25dee237e1d7e8b2432bd98f755b60e2c7f08a48d2c7b90000019a73736484 +0 -0
- package/cloudflare-worker/MIGRATION.md +160 -0
- package/cloudflare-worker/QUICKSTART.md +200 -0
- package/cloudflare-worker/README.md +242 -0
- package/cloudflare-worker/generate-token.js +32 -0
- package/cloudflare-worker/mini-native@latest.zip +0 -0
- package/cloudflare-worker/setup.sh +143 -0
- package/cloudflare-worker/test-recipe/apps/native/src/app/mini/index.tsx +15 -0
- package/cloudflare-worker/test-recipe/recipe.json +16 -0
- package/cloudflare-worker/worker.js +308 -0
- package/cloudflare-worker/wrangler.toml +13 -0
- package/dist/commands/add.d.ts +3 -0
- package/dist/commands/add.d.ts.map +1 -0
- package/dist/commands/add.js +149 -0
- package/dist/commands/add.js.map +1 -0
- package/dist/commands/devices.d.ts +3 -0
- package/dist/commands/devices.d.ts.map +1 -0
- package/dist/commands/devices.js +35 -0
- package/dist/commands/devices.js.map +1 -0
- package/dist/commands/doctor.d.ts +3 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +67 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/list.d.ts +3 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +40 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/login.d.ts +3 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/login.js +23 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/logout.d.ts +3 -0
- package/dist/commands/logout.d.ts.map +1 -0
- package/dist/commands/logout.js +16 -0
- package/dist/commands/logout.js.map +1 -0
- package/dist/commands/remove.d.ts +3 -0
- package/dist/commands/remove.d.ts.map +1 -0
- package/dist/commands/remove.js +67 -0
- package/dist/commands/remove.js.map +1 -0
- package/dist/core/__tests__/journal.test.d.ts +2 -0
- package/dist/core/__tests__/journal.test.d.ts.map +1 -0
- package/dist/core/__tests__/journal.test.js +101 -0
- package/dist/core/__tests__/journal.test.js.map +1 -0
- package/dist/core/__tests__/validate.test.d.ts +2 -0
- package/dist/core/__tests__/validate.test.d.ts.map +1 -0
- package/dist/core/__tests__/validate.test.js +53 -0
- package/dist/core/__tests__/validate.test.js.map +1 -0
- package/dist/core/archive.d.ts +2 -0
- package/dist/core/archive.d.ts.map +1 -0
- package/dist/core/archive.js +59 -0
- package/dist/core/archive.js.map +1 -0
- package/dist/core/auth.d.ts +15 -0
- package/dist/core/auth.d.ts.map +1 -0
- package/dist/core/auth.js +76 -0
- package/dist/core/auth.js.map +1 -0
- package/dist/core/codemod.d.ts +20 -0
- package/dist/core/codemod.d.ts.map +1 -0
- package/dist/core/codemod.js +150 -0
- package/dist/core/codemod.js.map +1 -0
- package/dist/core/fsx.d.ts +12 -0
- package/dist/core/fsx.d.ts.map +1 -0
- package/dist/core/fsx.js +70 -0
- package/dist/core/fsx.js.map +1 -0
- package/dist/core/http.d.ts +30 -0
- package/dist/core/http.d.ts.map +1 -0
- package/dist/core/http.js +95 -0
- package/dist/core/http.js.map +1 -0
- package/dist/core/journal.d.ts +18 -0
- package/dist/core/journal.d.ts.map +1 -0
- package/dist/core/journal.js +34 -0
- package/dist/core/journal.js.map +1 -0
- package/dist/core/log.d.ts +8 -0
- package/dist/core/log.d.ts.map +1 -0
- package/dist/core/log.js +9 -0
- package/dist/core/log.js.map +1 -0
- package/dist/core/pathGuard.d.ts +3 -0
- package/dist/core/pathGuard.d.ts.map +1 -0
- package/dist/core/pathGuard.js +18 -0
- package/dist/core/pathGuard.js.map +1 -0
- package/dist/core/paths.d.ts +11 -0
- package/dist/core/paths.d.ts.map +1 -0
- package/dist/core/paths.js +22 -0
- package/dist/core/paths.js.map +1 -0
- package/dist/core/validate.d.ts +8 -0
- package/dist/core/validate.d.ts.map +1 -0
- package/dist/core/validate.js +27 -0
- package/dist/core/validate.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/docs/decisions.md +55 -0
- package/package.json +39 -0
- package/recipes/audio-recorder/apps/native/src/app/audio-recorder/index.tsx +5 -0
- package/recipes/audio-recorder/apps/native/src/features/audio-recorder/components/audio-player.tsx +301 -0
- package/recipes/audio-recorder/apps/native/src/features/audio-recorder/components/audio-recorder.tsx +373 -0
- package/recipes/audio-recorder/apps/native/src/features/audio-recorder/components/audio-waveform.tsx +270 -0
- package/recipes/audio-recorder/apps/native/src/features/audio-recorder/components/index.ts +4 -0
- package/recipes/audio-recorder/apps/native/src/features/audio-recorder/components/recording-list.tsx +89 -0
- package/recipes/audio-recorder/apps/native/src/features/audio-recorder/demo/audio-player-demo.tsx +66 -0
- package/recipes/audio-recorder/apps/native/src/features/audio-recorder/demo/audio-recorder-cloud.tsx +68 -0
- package/recipes/audio-recorder/apps/native/src/features/audio-recorder/demo/audio-recorder-interview.tsx +102 -0
- package/recipes/audio-recorder/apps/native/src/features/audio-recorder/demo/basic.tsx +27 -0
- package/recipes/audio-recorder/apps/native/src/features/audio-recorder/demo/index.ts +5 -0
- package/recipes/audio-recorder/apps/native/src/features/audio-recorder/demo/with-recording-list-demo.tsx +82 -0
- package/recipes/audio-recorder/recipe.json +22 -0
- package/recipes/audio-recorder@latest.zip +0 -0
- package/recipes/charts/apps/native/src/app/charts/index.tsx +3 -0
- package/recipes/charts/apps/native/src/features/charts/README.md +185 -0
- package/recipes/charts/apps/native/src/features/charts/app/preview.tsx +223 -0
- package/recipes/charts/apps/native/src/features/charts/components/area-chart.tsx +40 -0
- package/recipes/charts/apps/native/src/features/charts/components/bar-chart.tsx +143 -0
- package/recipes/charts/apps/native/src/features/charts/components/candlestick-chart.tsx +196 -0
- package/recipes/charts/apps/native/src/features/charts/components/chart-card.tsx +65 -0
- package/recipes/charts/apps/native/src/features/charts/components/column-chart.tsx +143 -0
- package/recipes/charts/apps/native/src/features/charts/components/doughnut-chart.tsx +246 -0
- package/recipes/charts/apps/native/src/features/charts/components/index.ts +10 -0
- package/recipes/charts/apps/native/src/features/charts/components/line-chart.tsx +308 -0
- package/recipes/charts/apps/native/src/features/charts/components/radar-chart.tsx +180 -0
- package/recipes/charts/apps/native/src/features/charts/components/radial-bar-chart.tsx +188 -0
- package/recipes/charts/apps/native/src/features/charts/components/stacked-area-chart.tsx +265 -0
- package/recipes/charts/apps/native/src/features/charts/components/stacked-bar-chart.tsx +322 -0
- package/recipes/charts/apps/native/src/features/charts/data/mock-data.ts +183 -0
- package/recipes/charts/apps/native/src/features/charts/types/index.ts +66 -0
- package/recipes/charts/recipe.json +22 -0
- package/recipes/charts@latest.zip +0 -0
- package/recipes/chatbot/apps/native/src/app/chatbot/index.tsx +1 -0
- package/recipes/chatbot/apps/native/src/features/chatbot/app/index.tsx +302 -0
- package/recipes/chatbot/apps/native/src/features/chatbot/components/chat-header-buttons.tsx +59 -0
- package/recipes/chatbot/apps/native/src/features/chatbot/components/chat-input-bar.tsx +469 -0
- package/recipes/chatbot/apps/native/src/features/chatbot/components/chat-markdown.tsx +575 -0
- package/recipes/chatbot/apps/native/src/features/chatbot/components/chat-message-bubble.tsx +246 -0
- package/recipes/chatbot/apps/native/src/features/chatbot/components/chat-settings-modal.tsx +161 -0
- package/recipes/chatbot/apps/native/src/features/chatbot/components/image-preview-list.tsx +115 -0
- package/recipes/chatbot/apps/native/src/features/chatbot/components/markdown/code-block.tsx +165 -0
- package/recipes/chatbot/apps/native/src/features/chatbot/components/markdown/index.ts +10 -0
- package/recipes/chatbot/apps/native/src/features/chatbot/components/markdown/table-renderer.tsx +129 -0
- package/recipes/chatbot/apps/native/src/features/chatbot/components/message-error-boundary.tsx +78 -0
- package/recipes/chatbot/apps/native/src/features/chatbot/components/message-list.tsx +173 -0
- package/recipes/chatbot/apps/native/src/features/chatbot/components/model-selector.tsx +283 -0
- package/recipes/chatbot/apps/native/src/features/chatbot/components/report-content-modal.tsx +188 -0
- package/recipes/chatbot/apps/native/src/features/chatbot/components/suggested-messages.tsx +67 -0
- package/recipes/chatbot/apps/native/src/features/chatbot/constants/models.ts +20 -0
- package/recipes/chatbot/apps/native/src/features/chatbot/constants/report-reasons.ts +9 -0
- package/recipes/chatbot/apps/native/src/features/chatbot/hooks/use-attachment-cache.ts +143 -0
- package/recipes/chatbot/apps/native/src/features/chatbot/hooks/use-chat-config.ts +664 -0
- package/recipes/chatbot/apps/native/src/features/chatbot/hooks/use-chat-handlers.ts +359 -0
- package/recipes/chatbot/apps/native/src/features/chatbot/hooks/use-chatbot-settings.ts +89 -0
- package/recipes/chatbot/apps/native/src/features/chatbot/hooks/use-conversation.ts +79 -0
- package/recipes/chatbot/apps/native/src/features/chatbot/hooks/use-image-picker.ts +122 -0
- package/recipes/chatbot/apps/native/src/features/chatbot/hooks/use-keyboard-coordinator.ts +161 -0
- package/recipes/chatbot/apps/native/src/features/chatbot/hooks/use-smart-scroll-manager.ts +207 -0
- package/recipes/chatbot/apps/native/src/features/chatbot/models/index.ts +86 -0
- package/recipes/chatbot/apps/native/src/features/chatbot/models/models.ts +162 -0
- package/recipes/chatbot/apps/native/src/features/chatbot/models/providers.ts +62 -0
- package/recipes/chatbot/apps/native/src/features/chatbot/models/types.ts +40 -0
- package/recipes/chatbot/apps/native/src/features/chatbot/services/file-uploader.ts +238 -0
- package/recipes/chatbot/apps/native/src/features/chatbot/services/message-handler-service.ts +180 -0
- package/recipes/chatbot/apps/native/src/features/chatbot/types/index.ts +60 -0
- package/recipes/chatbot/apps/native/src/features/chatbot/utils/chat-telemetry.ts +91 -0
- package/recipes/chatbot/recipe.json +22 -0
- package/recipes/chatbot@latest.zip +0 -0
- package/recipes/image-generator/apps/native/src/app/image-generator/gallery.tsx +3 -0
- package/recipes/image-generator/apps/native/src/app/image-generator/index.tsx +3 -0
- package/recipes/image-generator/apps/native/src/features/image-generator/app/_layout.tsx +25 -0
- package/recipes/image-generator/apps/native/src/features/image-generator/app/gallery.tsx +217 -0
- package/recipes/image-generator/apps/native/src/features/image-generator/app/index.tsx +237 -0
- package/recipes/image-generator/apps/native/src/features/image-generator/components/gallery-image.tsx +26 -0
- package/recipes/image-generator/apps/native/src/features/image-generator/components/image-detail-modal.tsx +215 -0
- package/recipes/image-generator/apps/native/src/features/image-generator/components/image-model-selector.tsx +210 -0
- package/recipes/image-generator/apps/native/src/features/image-generator/components/image-placeholder.tsx +26 -0
- package/recipes/image-generator/apps/native/src/features/image-generator/hooks/use-image-gallery.ts +71 -0
- package/recipes/image-generator/apps/native/src/features/image-generator/hooks/use-image-generator-settings.ts +152 -0
- package/recipes/image-generator/apps/native/src/features/image-generator/hooks/use-image-generator.ts +93 -0
- package/recipes/image-generator/apps/native/src/features/image-generator/models/models.ts +66 -0
- package/recipes/image-generator/apps/native/src/features/image-generator/services/image-gallery-service.ts +98 -0
- package/recipes/image-generator/apps/native/src/features/image-generator/services/image-save-service.ts +121 -0
- package/recipes/image-generator/recipe.json +22 -0
- package/recipes/image-generator@latest.zip +0 -0
- package/recipes/quiz/apps/native/src/app/quiz/index.tsx +47 -0
- package/recipes/quiz/apps/native/src/features/quiz/components/question.tsx +67 -0
- package/recipes/quiz/apps/native/src/features/quiz/config.ts +11 -0
- package/recipes/quiz/apps/native/src/features/quiz/index.tsx +133 -0
- package/recipes/quiz/recipe.json +22 -0
- package/recipes/quiz@latest.zip +0 -0
- package/recipes/tracker-app/apps/native/src/app/tracker-app/index.tsx +1 -0
- package/recipes/tracker-app/apps/native/src/features/tracker-app/app/index.tsx +108 -0
- package/recipes/tracker-app/apps/native/src/features/tracker-app/components/animated-number.tsx +102 -0
- package/recipes/tracker-app/apps/native/src/features/tracker-app/components/calorie-card.tsx +66 -0
- package/recipes/tracker-app/apps/native/src/features/tracker-app/components/circular-progress.tsx +97 -0
- package/recipes/tracker-app/apps/native/src/features/tracker-app/components/floating-add-button.tsx +27 -0
- package/recipes/tracker-app/apps/native/src/features/tracker-app/components/macro-card.tsx +80 -0
- package/recipes/tracker-app/apps/native/src/features/tracker-app/components/promo-banner.tsx +98 -0
- package/recipes/tracker-app/apps/native/src/features/tracker-app/components/recently-logged.tsx +64 -0
- package/recipes/tracker-app/apps/native/src/features/tracker-app/components/week-calendar.tsx +68 -0
- package/recipes/tracker-app/recipe.json +22 -0
- package/recipes/tracker-app@latest.zip +0 -0
- package/recipes/upload-all.sh +32 -0
- package/recipes/voice-bot/apps/native/src/app/voice-bot/index.tsx +27 -0
- package/recipes/voice-bot/apps/native/src/features/voice-bot/README.md +185 -0
- package/recipes/voice-bot/apps/native/src/features/voice-bot/components/conversation-status.tsx +76 -0
- package/recipes/voice-bot/apps/native/src/features/voice-bot/components/index.ts +4 -0
- package/recipes/voice-bot/apps/native/src/features/voice-bot/components/message-input.tsx +98 -0
- package/recipes/voice-bot/apps/native/src/features/voice-bot/components/voice-bot-screen.tsx +173 -0
- package/recipes/voice-bot/apps/native/src/features/voice-bot/components/voice-controls.tsx +73 -0
- package/recipes/voice-bot/apps/native/src/features/voice-bot/index.ts +3 -0
- package/recipes/voice-bot/apps/native/src/features/voice-bot/services/index.ts +1 -0
- package/recipes/voice-bot/apps/native/src/features/voice-bot/services/use-voice-bot.ts +161 -0
- package/recipes/voice-bot/apps/native/src/features/voice-bot/types.ts +29 -0
- package/recipes/voice-bot/recipe.json +22 -0
- package/recipes/voice-bot@latest.zip +0 -0
- package/scripts/create-recipes.mjs +189 -0
- package/src/commands/add.ts +183 -0
- package/src/commands/devices.ts +38 -0
- package/src/commands/doctor.ts +67 -0
- package/src/commands/list.ts +45 -0
- package/src/commands/login.ts +24 -0
- package/src/commands/logout.ts +15 -0
- package/src/commands/remove.ts +78 -0
- package/src/core/__tests__/journal.test.ts +119 -0
- package/src/core/__tests__/validate.test.ts +64 -0
- package/src/core/archive.ts +69 -0
- package/src/core/auth.ts +103 -0
- package/src/core/codemod.ts +211 -0
- package/src/core/fsx.ts +80 -0
- package/src/core/http.ts +136 -0
- package/src/core/journal.ts +64 -0
- package/src/core/log.ts +9 -0
- package/src/core/pathGuard.ts +22 -0
- package/src/core/paths.ts +33 -0
- package/src/core/validate.ts +44 -0
- package/src/index.ts +27 -0
- package/test-critical-cases.mjs +258 -0
- package/tsconfig.json +21 -0
- package/vitest.config.mts +12 -0
package/PLAN.md
ADDED
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
# VibeFast CLI — A–Z Plan (Public CLI + Token Auth)
|
|
2
|
+
|
|
3
|
+
Monorepo: **apps/native (Expo SDK 54)** + **apps/web (Next.js)**. CLI installs shadcn-style feature code into either target.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Phase 0 — Decisions & Ground Rules
|
|
8
|
+
|
|
9
|
+
**Goal:** Freeze choices so the build stays simple and predictable.
|
|
10
|
+
|
|
11
|
+
**Decide:**
|
|
12
|
+
|
|
13
|
+
- **CLI package:** `vibefast-cli` (binary alias: `vf`).
|
|
14
|
+
- **Auth:** fixed opaque **token** per customer; **2 device slots** by default.
|
|
15
|
+
- **Delivery:** Cloudflare **Worker** validates token/seat → issues short‑lived **signed URL** to recipe **zip** in **R2/KV**.
|
|
16
|
+
- **Repo signature:** require `.vibefast/starter.json` with `{ "name": "vibefast", "version": "1.0.0", "targets": ["native","web"] }`.
|
|
17
|
+
- **Markers:**
|
|
18
|
+
|
|
19
|
+
- Native: `apps/native/src/app/(root)/(tabs)/index.tsx`
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
// --- @vibefast:navigation:start ---
|
|
23
|
+
{
|
|
24
|
+
/* CLI will inject feature links here */
|
|
25
|
+
}
|
|
26
|
+
// --- @vibefast:navigation:end ---
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
- Web: `apps/web/app/page.tsx`
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
{
|
|
33
|
+
/* @vibefast:nav:start */
|
|
34
|
+
}
|
|
35
|
+
{
|
|
36
|
+
/* CLI will inject feature cards here */
|
|
37
|
+
}
|
|
38
|
+
{
|
|
39
|
+
/* @vibefast:nav:end */
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
- **Journal:** `.vibefast/journal.json` (tracks files & nav inserts).
|
|
44
|
+
- **Default target:** `native` (override with `--target web`).
|
|
45
|
+
- **Rate limits:** 500/day, 30/min per token (tune later).
|
|
46
|
+
|
|
47
|
+
**Deliverable:** `/docs/decisions.md` summarizing the above.
|
|
48
|
+
|
|
49
|
+
**Accept:** Decisions doc exists; everyone agrees.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Phase 1 — Prepare VibeFast (one-time repo changes)
|
|
54
|
+
|
|
55
|
+
**Goal:** Make the monorepo detectable and codemods deterministic.
|
|
56
|
+
|
|
57
|
+
**Tasks:**
|
|
58
|
+
|
|
59
|
+
1. Add `.vibefast/starter.json` with the JSON above.
|
|
60
|
+
2. Add nav **markers** in the two files above (native + web).
|
|
61
|
+
3. Ensure TS path alias `@/` resolves correctly for both apps (or use relative imports in templates).
|
|
62
|
+
|
|
63
|
+
**Checklist:**
|
|
64
|
+
|
|
65
|
+
- [ ] Signature file present & valid JSON
|
|
66
|
+
- [ ] Markers present once in each target
|
|
67
|
+
- [ ] Both apps build
|
|
68
|
+
|
|
69
|
+
**Accept:** `grep` finds markers; both apps compile.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Phase 2 — Create the CLI (public npm package)
|
|
74
|
+
|
|
75
|
+
**Goal:** Scaffold a clean TypeScript CLI.
|
|
76
|
+
|
|
77
|
+
**Folder structure:**
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
/vibefast-cli
|
|
81
|
+
package.json
|
|
82
|
+
tsconfig.json
|
|
83
|
+
src/
|
|
84
|
+
index.ts # command router
|
|
85
|
+
commands/
|
|
86
|
+
add.ts
|
|
87
|
+
remove.ts
|
|
88
|
+
list.ts
|
|
89
|
+
doctor.ts
|
|
90
|
+
login.ts
|
|
91
|
+
devices.ts
|
|
92
|
+
logout.ts
|
|
93
|
+
core/
|
|
94
|
+
log.ts
|
|
95
|
+
paths.ts
|
|
96
|
+
fsx.ts
|
|
97
|
+
journal.ts
|
|
98
|
+
validate.ts
|
|
99
|
+
codemod.ts
|
|
100
|
+
http.ts
|
|
101
|
+
auth.ts
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**package.json:**
|
|
105
|
+
|
|
106
|
+
- name: `vibefast-cli`
|
|
107
|
+
- bin: `{ "vf": "dist/index.js" }`
|
|
108
|
+
- scripts: `build (tsc)`, `dev (tsx src/index.ts)`
|
|
109
|
+
- deps: `commander`, `picocolors`
|
|
110
|
+
- optional: `keytar` (secure token storage) — fallback to `~/.vibefast/config.json`
|
|
111
|
+
|
|
112
|
+
**Checklist:**
|
|
113
|
+
|
|
114
|
+
- [ ] `vf --help` runs locally
|
|
115
|
+
- [ ] Commands load without throwing
|
|
116
|
+
|
|
117
|
+
**Accept:** CLI starts and shows help.
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Phase 3 — Implement Core Utilities
|
|
122
|
+
|
|
123
|
+
**Goal:** Reusable helpers with tests.
|
|
124
|
+
|
|
125
|
+
- `log.ts` — success/info/warn/error with nice colors
|
|
126
|
+
- `paths.ts` — CWD, signature, journal, nav file paths for each target
|
|
127
|
+
- `fsx.ts` — `ensureDir`, `writeFile(force)`, `copyTree(dry,force)`, `exists`, `readFile`
|
|
128
|
+
- `journal.ts` — `{ feature, target, files[], insertedNav, ts }` CRUD at `.vibefast/journal.json`
|
|
129
|
+
- `validate.ts` — assert signature name `vibefast`; parse targets; semver gate if needed
|
|
130
|
+
- `codemod.ts` — `insertNavLinkNative`, `removeNavLinkNative`, `insertNavLinkWeb`, `removeNavLinkWeb` (string markers; idempotent via href check)
|
|
131
|
+
- `http.ts` — POST JSON to Worker; download signed zips to temp; unzip
|
|
132
|
+
- `auth.ts` — save/read token (keytar or file); generate stable `device_id` (username|hostname|os + persisted uuid)
|
|
133
|
+
|
|
134
|
+
**Checklist:**
|
|
135
|
+
|
|
136
|
+
- [ ] Unit tests for happy paths & basic errors
|
|
137
|
+
- [ ] `device_id` stable across runs
|
|
138
|
+
|
|
139
|
+
**Accept:** Tests pass locally.
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## Phase 4 — Recipe Format & First Recipes (mini-native, mini-web)
|
|
144
|
+
|
|
145
|
+
**Goal:** Define manifests and ship two demo zips.
|
|
146
|
+
|
|
147
|
+
### mini-native `recipe.json`
|
|
148
|
+
|
|
149
|
+
```json
|
|
150
|
+
{
|
|
151
|
+
"name": "mini-native",
|
|
152
|
+
"version": "0.1.0",
|
|
153
|
+
"description": "Demo feature (Expo)",
|
|
154
|
+
"copy": [
|
|
155
|
+
{
|
|
156
|
+
"from": "apps/native/src/app/(root)/(tabs)/mini",
|
|
157
|
+
"to": "apps/native/src/app/(root)/(tabs)/mini"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"from": "apps/native/src/components/mini",
|
|
161
|
+
"to": "apps/native/src/components/mini"
|
|
162
|
+
},
|
|
163
|
+
{ "from": "apps/native/src/lib/mini", "to": "apps/native/src/lib/mini" }
|
|
164
|
+
],
|
|
165
|
+
"nav": { "href": "/(root)/(tabs)/mini", "label": "Mini" },
|
|
166
|
+
"target": "native"
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
**Templates:**
|
|
171
|
+
|
|
172
|
+
- `apps/native/src/app/(root)/(tabs)/mini/index.tsx`
|
|
173
|
+
- `apps/native/src/components/mini/MiniCard.tsx`
|
|
174
|
+
- `apps/native/src/lib/mini/useMini.ts`
|
|
175
|
+
|
|
176
|
+
### mini-web `recipe.json`
|
|
177
|
+
|
|
178
|
+
```json
|
|
179
|
+
{
|
|
180
|
+
"name": "mini-web",
|
|
181
|
+
"version": "0.1.0",
|
|
182
|
+
"description": "Demo feature (Next.js)",
|
|
183
|
+
"copy": [
|
|
184
|
+
{ "from": "apps/web/app/mini", "to": "apps/web/app/mini" },
|
|
185
|
+
{ "from": "apps/web/components/mini", "to": "apps/web/components/mini" },
|
|
186
|
+
{ "from": "apps/web/lib/mini", "to": "apps/web/lib/mini" }
|
|
187
|
+
],
|
|
188
|
+
"nav": { "href": "/mini", "label": "Mini" },
|
|
189
|
+
"target": "web"
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
**Packaging:** Zip each recipe folder → `mini-native@0.1.0.zip`, `mini-web@0.1.0.zip`. Upload to R2 (or KV).
|
|
194
|
+
|
|
195
|
+
**Checklist:**
|
|
196
|
+
|
|
197
|
+
- [ ] Zips contain manifest + templates
|
|
198
|
+
- [ ] Destinations match VibeFast paths
|
|
199
|
+
|
|
200
|
+
**Accept:** Manual unzip matches tree.
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## Phase 5 — Cloudflare Worker Gateway (Auth + Signed URL)
|
|
205
|
+
|
|
206
|
+
**Goal:** Token validation, seat control, rate limit, signed URL issuance.
|
|
207
|
+
|
|
208
|
+
**POST /api/recipe/fetch**
|
|
209
|
+
|
|
210
|
+
- Request body:
|
|
211
|
+
|
|
212
|
+
```json
|
|
213
|
+
{
|
|
214
|
+
"token": "OPAQ_32CHARS",
|
|
215
|
+
"device": {
|
|
216
|
+
"id": "abc123…",
|
|
217
|
+
"os": "darwin",
|
|
218
|
+
"arch": "arm64",
|
|
219
|
+
"version": "1.0.0"
|
|
220
|
+
},
|
|
221
|
+
"feature": "mini-native",
|
|
222
|
+
"target": "native",
|
|
223
|
+
"starter": { "name": "vibefast", "version": "1.0.0" }
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
- Response:
|
|
228
|
+
|
|
229
|
+
```json
|
|
230
|
+
{
|
|
231
|
+
"ok": true,
|
|
232
|
+
"signedUrl": "https://…/mini-native@0.1.0.zip?...",
|
|
233
|
+
"expiresIn": 180,
|
|
234
|
+
"watermark": "…"
|
|
235
|
+
}
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
**Storage:**
|
|
239
|
+
|
|
240
|
+
- KV: `lic:<sha256(token)>` → `{ status, max_devices, devices[], rate }`
|
|
241
|
+
- R2: recipe zips per feature@version
|
|
242
|
+
|
|
243
|
+
**Checklist:**
|
|
244
|
+
|
|
245
|
+
- [ ] Worker deployed; KV & R2 bound
|
|
246
|
+
- [ ] Seeded token returns a signed URL
|
|
247
|
+
|
|
248
|
+
**Accept:** Invalid token → 403; seat limit → 403; valid → 200.
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
## Phase 6 — Auth & Device Commands (CLI)
|
|
253
|
+
|
|
254
|
+
**Goal:** Token storage + seat management.
|
|
255
|
+
|
|
256
|
+
- `vf login --token <TOKEN>` — store token (keytar or `~/.vibefast/config.json`)
|
|
257
|
+
- `vf devices` — list activations from Worker
|
|
258
|
+
- `vf devices --deactivate <id>` — free a slot
|
|
259
|
+
- `vf logout` — clear local token
|
|
260
|
+
|
|
261
|
+
**Checklist:**
|
|
262
|
+
|
|
263
|
+
- [ ] Token saved & retrieved
|
|
264
|
+
- [ ] Device list/deactivate works
|
|
265
|
+
|
|
266
|
+
**Accept:** Bad token errors are friendly.
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## Phase 7 — doctor / list / add / remove (Core Flow)
|
|
271
|
+
|
|
272
|
+
**Goal:** End-to-end installation experience for each target.
|
|
273
|
+
|
|
274
|
+
**doctor**
|
|
275
|
+
|
|
276
|
+
- Verify `.vibefast/starter.json` name `vibefast`
|
|
277
|
+
- Detect monorepo; default `native`, allow `--target web`
|
|
278
|
+
|
|
279
|
+
**list**
|
|
280
|
+
|
|
281
|
+
- Get catalog from Worker; group by `native` / `web`
|
|
282
|
+
|
|
283
|
+
**add <feature> [--target native|web] [--dry-run] [--force]**
|
|
284
|
+
|
|
285
|
+
- Validate signature
|
|
286
|
+
- Fetch signed URL → download to temp → unzip
|
|
287
|
+
- Read `recipe.json`; copy files (respect `--dry-run`/`--force`)
|
|
288
|
+
- Insert nav link (native or web variant)
|
|
289
|
+
- Record journal
|
|
290
|
+
- Print next steps
|
|
291
|
+
|
|
292
|
+
**remove <feature> [--target native|web] [--dry-run]**
|
|
293
|
+
|
|
294
|
+
- Read journal; delete files; remove nav link; update journal
|
|
295
|
+
|
|
296
|
+
**Checklist:**
|
|
297
|
+
|
|
298
|
+
- [ ] Re‑add is no‑op unless `--force`
|
|
299
|
+
- [ ] Remove leaves repo clean
|
|
300
|
+
|
|
301
|
+
**Accept:** E2E on fresh clone: `vf doctor` → `vf add mini-native` → app shows link → `vf remove mini-native` cleans up.
|
|
302
|
+
|
|
303
|
+
---
|
|
304
|
+
|
|
305
|
+
## Phase 8 — Watermarking & Anti‑Sharing
|
|
306
|
+
|
|
307
|
+
**Goal:** Trace leaks and deter casual sharing.
|
|
308
|
+
|
|
309
|
+
- Worker returns `watermark` (token hash suffix + device suffix)
|
|
310
|
+
- CLI injects `// vibefast license: <watermark>` at top of each copied file
|
|
311
|
+
- Handle `429` with friendly cooldown message
|
|
312
|
+
|
|
313
|
+
**Accept:** Files contain watermark; rate limit enforced.
|
|
314
|
+
|
|
315
|
+
---
|
|
316
|
+
|
|
317
|
+
## Phase 9 — Testing (Unit + E2E)
|
|
318
|
+
|
|
319
|
+
**Goal:** Confidence before publish.
|
|
320
|
+
|
|
321
|
+
**Unit:** fsx, codemod (with/without markers), journal, auth.deviceId
|
|
322
|
+
|
|
323
|
+
**E2E (CI):**
|
|
324
|
+
|
|
325
|
+
1. Clone VibeFast fixture
|
|
326
|
+
2. `vf doctor` ✓
|
|
327
|
+
3. `vf add mini-native` → files + nav + journal ✓; re‑run is no‑op ✓
|
|
328
|
+
4. `vf remove mini-native` → clean ✓
|
|
329
|
+
5. invalid token → blocked ✓
|
|
330
|
+
6. seat limit → friendly error ✓
|
|
331
|
+
|
|
332
|
+
**Accept:** Tests pass; snapshot diff clean.
|
|
333
|
+
|
|
334
|
+
---
|
|
335
|
+
|
|
336
|
+
## Phase 10 — Packaging & Release
|
|
337
|
+
|
|
338
|
+
**Goal:** Publish the public CLI; recipes remain private.
|
|
339
|
+
|
|
340
|
+
- `package.json`: `"bin": { "vf": "dist/index.js" }`
|
|
341
|
+
- `npm run build` (tsc)
|
|
342
|
+
- Publish to npm (public)
|
|
343
|
+
- README usage:
|
|
344
|
+
|
|
345
|
+
```bash
|
|
346
|
+
npx vibefast-cli login --token <YOUR_TOKEN>
|
|
347
|
+
vf doctor
|
|
348
|
+
vf list
|
|
349
|
+
vf add mini-native
|
|
350
|
+
vf add mini-web --target web
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
**Accept:** Fresh machine + fresh VibeFast clone → full flow works.
|
|
354
|
+
|
|
355
|
+
---
|
|
356
|
+
|
|
357
|
+
## Phase 11 — Add Real Recipes (charts, chatbot, voice, images)
|
|
358
|
+
|
|
359
|
+
**Goal:** Expand library using same manifest pattern.
|
|
360
|
+
|
|
361
|
+
For each feature:
|
|
362
|
+
|
|
363
|
+
- Place templates under app‑specific folders (`apps/native/...` or `apps/web/...`)
|
|
364
|
+
- Include `recipe.json` with `target`, `copy[]`, `nav`, optional `env/config` notes
|
|
365
|
+
- Zip & upload; update catalog
|
|
366
|
+
- E2E test install/remove
|
|
367
|
+
|
|
368
|
+
**Accept:** Templates compile; route reachable; removal clean.
|
|
369
|
+
|
|
370
|
+
---
|
|
371
|
+
|
|
372
|
+
## Phase 12 — Nice‑to‑Haves (Post‑MVP)
|
|
373
|
+
|
|
374
|
+
- `vf diff` — preview changes before apply
|
|
375
|
+
- `vf update <feature>` — migration runner between versions
|
|
376
|
+
- `vf doctor --fix` — auto‑add missing markers
|
|
377
|
+
- Config mutations (marker blocks in `app.config.ts` if needed)
|
|
378
|
+
- Optional telemetry (opt‑in)
|
|
379
|
+
|
|
380
|
+
---
|
|
381
|
+
|
|
382
|
+
## Phase 13 — Security & Ops
|
|
383
|
+
|
|
384
|
+
- **Revoke:** set `status=revoked` → 403 immediately
|
|
385
|
+
- **Rotate:** issue new token; optionally migrate active devices
|
|
386
|
+
- **Anomalies:** auto‑lock if unusual device churn; notify
|
|
387
|
+
- **Backups:** nightly KV export to R2; version recipe zips
|
|
388
|
+
- **Monitoring:** token counts, error rates, p95 latency
|
|
389
|
+
|
|
390
|
+
---
|
|
391
|
+
|
|
392
|
+
## Phase 14 — Junior Dev Daily Checklist
|
|
393
|
+
|
|
394
|
+
- Pull latest; `npm run build`
|
|
395
|
+
- Run unit tests; run E2E on fixture
|
|
396
|
+
- Manual sanity: `doctor`, `add`, `remove`
|
|
397
|
+
- Verify Worker with staging token
|
|
398
|
+
- Update docs if CLI surface changes
|
|
399
|
+
|
|
400
|
+
---
|
|
401
|
+
|
|
402
|
+
## Acceptance Criteria Summary (MVP)
|
|
403
|
+
|
|
404
|
+
- Public CLI on npm; `vf` works
|
|
405
|
+
- `login`, `devices`, `logout`, `doctor`, `list`, `add`, `remove` implemented
|
|
406
|
+
- Token + 2‑device enforcement works
|
|
407
|
+
- Signed URL delivery working
|
|
408
|
+
- Idempotent add/remove; watermark injected
|
|
409
|
+
- Unit + E2E tests green in CI
|
|
410
|
+
|
|
411
|
+
---
|
|
412
|
+
|
|
413
|
+
## Appendix — Data Shapes
|
|
414
|
+
|
|
415
|
+
**CLI → Worker `recipe.fetch`**
|
|
416
|
+
|
|
417
|
+
```json
|
|
418
|
+
{
|
|
419
|
+
"token": "OPAQ_32CHARS",
|
|
420
|
+
"device": {
|
|
421
|
+
"id": "abc123…",
|
|
422
|
+
"os": "darwin",
|
|
423
|
+
"arch": "arm64",
|
|
424
|
+
"version": "1.0.0"
|
|
425
|
+
},
|
|
426
|
+
"feature": "mini-native",
|
|
427
|
+
"target": "native",
|
|
428
|
+
"starter": { "name": "vibefast", "version": "1.0.0" }
|
|
429
|
+
}
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
**Worker response**
|
|
433
|
+
|
|
434
|
+
```json
|
|
435
|
+
{
|
|
436
|
+
"ok": true,
|
|
437
|
+
"signedUrl": "https://…/mini-native@0.1.0.zip?...",
|
|
438
|
+
"expiresIn": 180,
|
|
439
|
+
"watermark": "…"
|
|
440
|
+
}
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
**Journal entry**
|
|
444
|
+
|
|
445
|
+
```json
|
|
446
|
+
{
|
|
447
|
+
"feature": "mini-native",
|
|
448
|
+
"target": "native",
|
|
449
|
+
"files": ["/abs/apps/native/src/app/(root)/(tabs)/mini/index.tsx"],
|
|
450
|
+
"insertedNav": true,
|
|
451
|
+
"ts": 1731300000000
|
|
452
|
+
}
|
|
453
|
+
```
|
package/README.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# VibeFast CLI
|
|
2
|
+
|
|
3
|
+
Official CLI for installing VibeFast features into your monorepo.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g vibefast-cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or use directly with npx:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx vibefast-cli <command>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
1. **Login with your token:**
|
|
20
|
+
```bash
|
|
21
|
+
vf login --token YOUR_TOKEN_HERE
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
2. **Verify your setup:**
|
|
25
|
+
```bash
|
|
26
|
+
vf doctor
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
3. **List available features:**
|
|
30
|
+
```bash
|
|
31
|
+
vf list
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
4. **Install a feature:**
|
|
35
|
+
```bash
|
|
36
|
+
vf add mini-native
|
|
37
|
+
vf add mini-web --target web
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
5. **Remove a feature:**
|
|
41
|
+
```bash
|
|
42
|
+
vf remove mini-native
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Commands
|
|
46
|
+
|
|
47
|
+
### `vf login --token <TOKEN>`
|
|
48
|
+
Authenticate with your VibeFast license token.
|
|
49
|
+
|
|
50
|
+
### `vf logout`
|
|
51
|
+
Clear your stored token.
|
|
52
|
+
|
|
53
|
+
### `vf devices`
|
|
54
|
+
List your active device activations.
|
|
55
|
+
|
|
56
|
+
**Options:**
|
|
57
|
+
- `--deactivate <id>` - Free up a device slot
|
|
58
|
+
|
|
59
|
+
### `vf doctor`
|
|
60
|
+
Check your VibeFast setup and verify all requirements.
|
|
61
|
+
|
|
62
|
+
### `vf list`
|
|
63
|
+
Show all available features for your license.
|
|
64
|
+
|
|
65
|
+
### `vf add <feature>`
|
|
66
|
+
Install a feature into your project.
|
|
67
|
+
|
|
68
|
+
**Options:**
|
|
69
|
+
- `--target <native|web>` - Target platform (default: native)
|
|
70
|
+
- `--dry-run` - Preview changes without applying
|
|
71
|
+
- `--force` - Overwrite existing files
|
|
72
|
+
|
|
73
|
+
**Example:**
|
|
74
|
+
```bash
|
|
75
|
+
vf add charts --target native
|
|
76
|
+
vf add chatbot --target web --force
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### `vf remove <feature>`
|
|
80
|
+
Remove an installed feature.
|
|
81
|
+
|
|
82
|
+
**Options:**
|
|
83
|
+
- `--target <native|web>` - Target platform (default: native)
|
|
84
|
+
- `--dry-run` - Preview changes without applying
|
|
85
|
+
|
|
86
|
+
**Example:**
|
|
87
|
+
```bash
|
|
88
|
+
vf remove charts --target native
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Requirements
|
|
92
|
+
|
|
93
|
+
- Node.js 18+
|
|
94
|
+
- A VibeFast monorepo with `.vibefast/starter.json`
|
|
95
|
+
- Valid VibeFast license token
|
|
96
|
+
|
|
97
|
+
## Device Limits
|
|
98
|
+
|
|
99
|
+
Each license includes 2 device slots by default. A device is identified by a stable ID based on your machine's username, hostname, and OS. You can manage your devices with:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
vf devices # List active devices
|
|
103
|
+
vf devices --deactivate <id> # Free a slot
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Troubleshooting
|
|
107
|
+
|
|
108
|
+
**"Not a VibeFast repo"**
|
|
109
|
+
- Make sure you're in the root of your VibeFast monorepo
|
|
110
|
+
- Check that `.vibefast/starter.json` exists
|
|
111
|
+
|
|
112
|
+
**"Not logged in"**
|
|
113
|
+
- Run `vf login --token <YOUR_TOKEN>`
|
|
114
|
+
|
|
115
|
+
**"Device limit reached"**
|
|
116
|
+
- Run `vf devices` to see active devices
|
|
117
|
+
- Deactivate unused devices with `vf devices --deactivate <id>`
|
|
118
|
+
|
|
119
|
+
**"Missing navigation markers"**
|
|
120
|
+
- Ensure your nav files have the required marker comments
|
|
121
|
+
- Run `vf doctor` to check
|
|
122
|
+
|
|
123
|
+
## Environment Variables
|
|
124
|
+
|
|
125
|
+
- `VIBEFAST_WORKER_URL` - Override the API endpoint (default: https://api.vibefast.com)
|
|
126
|
+
|
|
127
|
+
## Support
|
|
128
|
+
|
|
129
|
+
For issues or questions, contact support@vibefast.com
|