@intelligo-dev/cli 1.0.0-beta.1 → 1.0.0-beta.14

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 (223) hide show
  1. package/NOTICE +6 -0
  2. package/README.md +102 -0
  3. package/dist/bin.js +122 -37
  4. package/dist/bin.js.map +1 -1
  5. package/dist/commands/add.d.ts +26 -1
  6. package/dist/commands/add.d.ts.map +1 -1
  7. package/dist/commands/add.js +70 -4
  8. package/dist/commands/add.js.map +1 -1
  9. package/dist/commands/create-flow.d.ts +37 -0
  10. package/dist/commands/create-flow.d.ts.map +1 -0
  11. package/dist/commands/create-flow.js +212 -0
  12. package/dist/commands/create-flow.js.map +1 -0
  13. package/dist/commands/create.d.ts +27 -6
  14. package/dist/commands/create.d.ts.map +1 -1
  15. package/dist/commands/create.js +53 -13
  16. package/dist/commands/create.js.map +1 -1
  17. package/dist/commands/doctor.d.ts +14 -3
  18. package/dist/commands/doctor.d.ts.map +1 -1
  19. package/dist/commands/doctor.js +295 -37
  20. package/dist/commands/doctor.js.map +1 -1
  21. package/dist/commands/migrate-check.d.ts +73 -1
  22. package/dist/commands/migrate-check.d.ts.map +1 -1
  23. package/dist/commands/migrate-check.js +130 -5
  24. package/dist/commands/migrate-check.js.map +1 -1
  25. package/dist/commands/migrate.d.ts +97 -0
  26. package/dist/commands/migrate.d.ts.map +1 -0
  27. package/dist/commands/migrate.js +141 -0
  28. package/dist/commands/migrate.js.map +1 -0
  29. package/dist/commands/sync-messages.d.ts +37 -0
  30. package/dist/commands/sync-messages.d.ts.map +1 -0
  31. package/dist/commands/sync-messages.js +88 -0
  32. package/dist/commands/sync-messages.js.map +1 -0
  33. package/dist/commands/sync-scaffold.d.ts +36 -0
  34. package/dist/commands/sync-scaffold.d.ts.map +1 -0
  35. package/dist/commands/sync-scaffold.js +53 -0
  36. package/dist/commands/sync-scaffold.js.map +1 -0
  37. package/dist/commands/sync.d.ts +103 -0
  38. package/dist/commands/sync.d.ts.map +1 -0
  39. package/dist/commands/sync.js +361 -0
  40. package/dist/commands/sync.js.map +1 -0
  41. package/dist/commands/upgrade-check.d.ts +5 -5
  42. package/dist/commands/upgrade-check.d.ts.map +1 -1
  43. package/dist/commands/upgrade-check.js +22 -6
  44. package/dist/commands/upgrade-check.js.map +1 -1
  45. package/dist/env-files.d.ts +12 -0
  46. package/dist/env-files.d.ts.map +1 -0
  47. package/dist/env-files.js +29 -0
  48. package/dist/env-files.js.map +1 -0
  49. package/dist/index.d.ts +9 -0
  50. package/dist/index.d.ts.map +1 -1
  51. package/dist/index.js +9 -0
  52. package/dist/index.js.map +1 -1
  53. package/dist/manifest.d.ts +36 -15
  54. package/dist/manifest.d.ts.map +1 -1
  55. package/dist/manifest.js +32 -16
  56. package/dist/manifest.js.map +1 -1
  57. package/dist/migrations.d.ts +3 -6
  58. package/dist/migrations.d.ts.map +1 -1
  59. package/dist/migrations.js +3 -6
  60. package/dist/migrations.js.map +1 -1
  61. package/dist/model-catalogue.d.ts +14 -0
  62. package/dist/model-catalogue.d.ts.map +1 -0
  63. package/dist/model-catalogue.js +34 -0
  64. package/dist/model-catalogue.js.map +1 -0
  65. package/dist/module-exports.d.ts +63 -0
  66. package/dist/module-exports.d.ts.map +1 -0
  67. package/dist/module-exports.js +231 -0
  68. package/dist/module-exports.js.map +1 -0
  69. package/dist/registry-bundle.d.ts +43 -0
  70. package/dist/registry-bundle.d.ts.map +1 -0
  71. package/dist/registry-bundle.js +74 -0
  72. package/dist/registry-bundle.js.map +1 -0
  73. package/dist/registry-items.d.ts +84 -0
  74. package/dist/registry-items.d.ts.map +1 -0
  75. package/dist/registry-items.js +187 -0
  76. package/dist/registry-items.js.map +1 -0
  77. package/package.json +36 -10
  78. package/src/bin.ts +316 -0
  79. package/src/commands/add.ts +255 -0
  80. package/src/commands/create-flow.ts +284 -0
  81. package/src/commands/create.ts +149 -0
  82. package/src/commands/doctor.ts +487 -0
  83. package/src/commands/migrate-check.ts +298 -0
  84. package/src/commands/migrate.ts +228 -0
  85. package/src/commands/sync-messages.ts +114 -0
  86. package/src/commands/sync-scaffold.ts +83 -0
  87. package/src/commands/sync.ts +534 -0
  88. package/src/commands/upgrade-check.ts +160 -0
  89. package/src/env-files.ts +31 -0
  90. package/src/index.ts +39 -0
  91. package/src/manifest.ts +147 -0
  92. package/src/migrations-dir.ts +25 -0
  93. package/src/migrations.ts +133 -0
  94. package/src/model-catalogue.ts +35 -0
  95. package/src/module-exports.ts +266 -0
  96. package/src/registry-bundle.ts +103 -0
  97. package/src/registry-items.ts +237 -0
  98. package/templates/admin-page/admin-page.tsx.tpl +2 -3
  99. package/templates/app-scaffold/assistant-route.ts.tpl +2 -2
  100. package/templates/app-scaffold/auth-route.ts.tpl +10 -0
  101. package/templates/app-scaffold/components.json.tpl +6 -2
  102. package/templates/app-scaffold/db-schema.ts.tpl +29 -0
  103. package/templates/app-scaffold/drizzle-journal.json.tpl +5 -0
  104. package/templates/app-scaffold/drizzle.config.ts.tpl +45 -0
  105. package/templates/app-scaffold/env.example.tpl +65 -1
  106. package/templates/app-scaffold/globals.css.tpl +172 -281
  107. package/templates/app-scaffold/i18n-request.ts.tpl +25 -0
  108. package/templates/app-scaffold/instrumentation.ts.tpl +21 -0
  109. package/templates/app-scaffold/intelligo.ts.tpl +95 -41
  110. package/templates/app-scaffold/layout.tsx.tpl +18 -1
  111. package/templates/app-scaffold/lib-utils.ts.tpl +1 -6
  112. package/templates/app-scaffold/next.config.mjs.tpl +2 -0
  113. package/templates/app-scaffold/package.json.tpl +31 -17
  114. package/templates/app-scaffold/page.tsx.tpl +16 -0
  115. package/templates/app-scaffold/plans.ts.tpl +32 -13
  116. package/templates/app-scaffold/{middleware.ts.tpl → proxy.ts.tpl} +6 -0
  117. package/templates/app-scaffold/sonner.tsx.tpl +42 -20
  118. package/templates/app-scaffold/stripe-webhook-route.ts.tpl +24 -0
  119. package/templates/app-scaffold/theme-provider.tsx.tpl +6 -4
  120. package/templates/app-scaffold/tsconfig.json.tpl +20 -4
  121. package/templates/app-scaffold/use-mobile.ts.tpl +19 -0
  122. package/templates/app-scaffold/workspace-bootstrap.ts.tpl +30 -0
  123. package/templates/maintenance/maintenance-route.ts.tpl +119 -0
  124. package/templates/manifest.json +75 -17
  125. package/templates/registry/ai-agent-activity.json +23 -0
  126. package/templates/registry/ai-agent-progress.json +21 -0
  127. package/templates/registry/ai-approval-card.json +27 -0
  128. package/templates/registry/ai-artifact.json +22 -0
  129. package/templates/registry/ai-branch.json +21 -0
  130. package/templates/registry/ai-citations.json +24 -0
  131. package/templates/registry/ai-code-block.json +23 -0
  132. package/templates/registry/ai-composer-menu.json +19 -0
  133. package/templates/registry/ai-file-diff.json +25 -0
  134. package/templates/registry/ai-image-generation.json +23 -0
  135. package/templates/registry/ai-markdown.json +23 -0
  136. package/templates/registry/ai-message-bubble.json +23 -0
  137. package/templates/registry/ai-message-scroller.json +22 -0
  138. package/templates/registry/ai-message.json +21 -0
  139. package/templates/registry/ai-motion.json +19 -0
  140. package/templates/registry/ai-prompt-input.json +28 -0
  141. package/templates/registry/ai-reasoning-text.json +22 -0
  142. package/templates/registry/ai-reasoning.json +22 -0
  143. package/templates/registry/ai-shimmer-text.json +19 -0
  144. package/templates/registry/ai-sidebar.json +25 -0
  145. package/templates/registry/ai-speech-input.json +21 -0
  146. package/templates/registry/ai-streaming-response.json +24 -0
  147. package/templates/registry/ai-suggestion.json +19 -0
  148. package/templates/registry/ai-todo-list.json +22 -0
  149. package/templates/registry/ai-tool-approval.json +26 -0
  150. package/templates/registry/ai-tool-result.json +25 -0
  151. package/templates/registry/alert-dialog.json +23 -0
  152. package/templates/registry/animated-list.json +21 -0
  153. package/templates/registry/app-shell.json +93 -0
  154. package/templates/registry/artifacts.json +82 -0
  155. package/templates/registry/attachment.json +22 -0
  156. package/templates/registry/auth-email-verification.json +39 -0
  157. package/templates/registry/auth-login.json +72 -0
  158. package/templates/registry/auth-password-reset.json +53 -0
  159. package/templates/registry/auth-signup.json +41 -0
  160. package/templates/registry/billing-settings.json +60 -0
  161. package/templates/registry/button.json +22 -0
  162. package/templates/registry/chat-eve.json +19 -0
  163. package/templates/registry/chat-panel.json +30 -0
  164. package/templates/registry/chat-share.json +42 -0
  165. package/templates/registry/chat-widget.json +34 -0
  166. package/templates/registry/chat.json +326 -0
  167. package/templates/registry/checkbox.json +22 -0
  168. package/templates/registry/checkout.json +40 -0
  169. package/templates/registry/collapsible.json +19 -0
  170. package/templates/registry/command.json +23 -0
  171. package/templates/registry/copy-button.json +21 -0
  172. package/templates/registry/dashboard.json +69 -0
  173. package/templates/registry/dialog.json +24 -0
  174. package/templates/registry/document-viewer.json +22 -0
  175. package/templates/registry/dropdown-menu.json +23 -0
  176. package/templates/registry/expandable-tabs.json +22 -0
  177. package/templates/registry/feature-gating.json +73 -0
  178. package/templates/registry/file-upload.json +24 -0
  179. package/templates/registry/hold-action-button.json +22 -0
  180. package/templates/registry/input-group.json +23 -0
  181. package/templates/registry/input.json +19 -0
  182. package/templates/registry/intelligo.json +187 -0
  183. package/templates/registry/invitation-accept.json +64 -0
  184. package/templates/registry/language-switcher.json +29 -0
  185. package/templates/registry/morphing-modal.json +24 -0
  186. package/templates/registry/notification-stack.json +24 -0
  187. package/templates/registry/notifications.json +87 -0
  188. package/templates/registry/onboarding.json +83 -0
  189. package/templates/registry/otp-input.json +22 -0
  190. package/templates/registry/page-header.json +15 -0
  191. package/templates/registry/payment-poll.json +52 -0
  192. package/templates/registry/popover-morph.json +22 -0
  193. package/templates/registry/popover.json +22 -0
  194. package/templates/registry/pricing.json +111 -0
  195. package/templates/registry/privacy-settings.json +65 -0
  196. package/templates/registry/profile-settings.json +68 -0
  197. package/templates/registry/progress.json +19 -0
  198. package/templates/registry/radio-group.json +22 -0
  199. package/templates/registry/registry.json +2945 -0
  200. package/templates/registry/route-error.json +65 -0
  201. package/templates/registry/select-morph.json +23 -0
  202. package/templates/registry/select.json +23 -0
  203. package/templates/registry/settings-shell.json +47 -0
  204. package/templates/registry/sheet.json +24 -0
  205. package/templates/registry/sidebar.json +28 -0
  206. package/templates/registry/smoke.json +34 -0
  207. package/templates/registry/spinner.json +16 -0
  208. package/templates/registry/stat-card.json +18 -0
  209. package/templates/registry/status-badge.json +18 -0
  210. package/templates/registry/switch.json +20 -0
  211. package/templates/registry/tabs.json +23 -0
  212. package/templates/registry/team-settings.json +97 -0
  213. package/templates/registry/textarea.json +16 -0
  214. package/templates/registry/tooltip.json +22 -0
  215. package/templates/registry/trial-banner.json +43 -0
  216. package/templates/registry/usage.json +84 -0
  217. package/templates/registry/workspace-settings.json +71 -0
  218. package/templates/registry-items.json +116 -0
  219. package/templates/registry-requires.json +180 -0
  220. package/templates/usage-page/usage-page.tsx.tpl +23 -8
  221. package/templates/vitest/server-only.ts.tpl +7 -0
  222. package/templates/vitest/vitest.config.ts.tpl +37 -0
  223. package/templates/billing-page/billing-page.tsx.tpl +0 -72
@@ -0,0 +1,116 @@
1
+ {
2
+ "items": {
3
+ "route-error": {
4
+ "title": "Route Error States",
5
+ "description": "The app's error surfaces: a shared RouteError component every error.tsx renders, message-based error classification, an (app) group boundary, a translated 404, and a dependency-free global-error. Error reporting goes through the lib/error-reporting.ts seam (a no-op until you bind a reporter), so no SDK enters the registry. Items that ship an error.tsx depend on this one - install it first."
6
+ },
7
+ "team-settings": {
8
+ "title": "Team Settings",
9
+ "description": "Workspace team management: invite members, change roles, remove members, and manage pending invitations, backed by the framework's team service."
10
+ },
11
+ "usage": {
12
+ "title": "Usage",
13
+ "description": "Workspace usage dashboard: current-period summary tiles, a period selector, and a table of recent AI execution records."
14
+ },
15
+ "invitation-accept": {
16
+ "title": "Invitation Accept",
17
+ "description": "Accept or decline a workspace invitation via the team service. Requires the team-settings item (provides lib/team.ts and the role badge); install it first."
18
+ },
19
+ "app-shell": {
20
+ "title": "App Shell",
21
+ "description": "Authenticated application shell: session and onboarding gate, workspace bootstrap, a sidebar that morphs into an icon rail with a gliding active pill, workspace switcher, configurable nav and user menu, and a page region that lifts each section in."
22
+ },
23
+ "settings-shell": {
24
+ "title": "Settings Shell",
25
+ "description": "The shared frame around every /settings page: layout with heading and width constraint, a configurable tab bar (lib/settings-nav.ts), and a /settings index that redirects to the first tab. Install alongside the settings items - without it they render unframed and plain /settings links 404."
26
+ },
27
+ "workspace-settings": {
28
+ "title": "Workspace Settings",
29
+ "description": "Workspace name/URL editing and owner-only deletion, backed by the framework's workspace service."
30
+ },
31
+ "auth-login": {
32
+ "title": "Auth: Login",
33
+ "description": "Email/password and OAuth login. Ships the shared auth route layout, the de-branded AuthCard shell, and the auth-validation.ts zod schemas reused by auth-signup, auth-password-reset, and auth-email-verification - install this item first."
34
+ },
35
+ "auth-signup": {
36
+ "title": "Auth: Signup",
37
+ "description": "Email/password and OAuth account creation. Requires the auth-login item (provides the shared AuthCard shell, SocialLoginButtons, and lib/auth-validation.ts schemas); install it first. Redirects to auth-email-verification's /verify-email route when the server requires email verification."
38
+ },
39
+ "auth-password-reset": {
40
+ "title": "Auth: Password Reset",
41
+ "description": "Forgot-password and reset-password pages, backed by the Better-Auth client SDK's requestPasswordReset/resetPassword actions. Requires the auth-login item (provides the shared AuthCard shell and lib/auth-validation.ts schemas); install it first."
42
+ },
43
+ "auth-email-verification": {
44
+ "title": "Auth: Email Verification",
45
+ "description": "Post-signup email verification status page with a resend control, backed by the Better-Auth client SDK's sendVerificationEmail action. Reads the ?error=/?email= search params Better-Auth's own /verify-email link handler redirects back with. Requires the auth-login item (provides the shared AuthCard shell); install it first."
46
+ },
47
+ "language-switcher": {
48
+ "title": "Language Switcher",
49
+ "description": "Locale dropdown over the locales i18n/routing.ts declares, labeled with each language's own name. Renders nothing in a single-locale deployment, so it is safe to mount unconditionally (e.g. in shellConfig.headerRight). Adding a locale to routing.ts plus a messages directory is the whole job."
50
+ },
51
+ "trial-banner": {
52
+ "title": "Trial Banner",
53
+ "description": "Dismissable trial-status strip for the app shell's bannerTop seam: days and credits remaining with an upgrade CTA, urgency-ramped visuals, dismiss-for-today, and a consumer config (lib/trial-banner-config.ts) for the CTA target and route suppression (hidden on /chat by default). Bind TrialBannerContainer as shellConfig.bannerTop."
54
+ },
55
+ "notifications": {
56
+ "title": "Notifications",
57
+ "description": "Notification bell with an unread badge and dropdown, plus a full notifications page with mark-as-read and load-more, backed by the framework's notification records."
58
+ },
59
+ "pricing": {
60
+ "title": "Pricing",
61
+ "description": "Plan comparison and upgrade page with a monthly/yearly toggle, backed by the framework's checkout service and the product's registered plan catalogue. Ships the lib/billing.ts product binding and actions/billing.ts checkout actions that the checkout and billing-settings items also depend on — install this item first."
62
+ },
63
+ "checkout": {
64
+ "title": "Checkout",
65
+ "description": "Checkout-success page that verifies the Stripe session directly through the framework's checkout service, covering the webhook-race window between the browser redirect and Stripe's webhook delivery."
66
+ },
67
+ "billing-settings": {
68
+ "title": "Billing Settings",
69
+ "description": "Workspace billing management: current plan, credit balance, credit bundle purchase, and the Stripe billing portal, shaped server-side by role (member/admin/owner). Requires the pricing item (provides lib/billing.ts and actions/billing.ts); install it first."
70
+ },
71
+ "feature-gating": {
72
+ "title": "Feature Gating",
73
+ "description": "The vocabulary for selling a plan: a server-side FeatureGate that renders gated content only to entitled workspaces, three densities of upgrade prompt (full, compact, inline), a quota warning that escalates as a limit approaches, and a preview paywall that blurs content instead of hiding it. Which features exist and which plan unlocks them is consumer config (lib/feature-catalog.ts). Install pricing or billing-settings for somewhere to send the user."
74
+ },
75
+ "payment-poll": {
76
+ "title": "QR Payment (poll)",
77
+ "description": "The non-card checkout the catalogue was missing: issue an invoice, show a QR the user scans in their banking app, poll until the provider confirms. Provider-agnostic — QPay, SocialPay, PIX, UPI, PromptPay all fit — with the invoice recorded and a paid one granted on the server; lib/local-payment.ts says what each reference costs and grants. Requires the pricing item for lib/billing-config.ts's CURRENCY."
78
+ },
79
+ "profile-settings": {
80
+ "title": "Profile Settings",
81
+ "description": "User profile name editing, read-only email, and account deletion with typed confirmation, backed by the framework's profile service."
82
+ },
83
+ "onboarding": {
84
+ "title": "Onboarding",
85
+ "description": "A generic multi-step onboarding wizard driven by a consumer-owned steps config: text and single-select-card fields, a completion screen, skip, and back/next - backed by the framework's onboarding service (durable step progress, no vertical-specific UI)."
86
+ },
87
+ "dashboard": {
88
+ "title": "Dashboard",
89
+ "description": "An AI-first workspace home: a hero and a real composer centred as one unit, starter chips that fill it, and a resume affordance for unfinished work — and nothing else, because history belongs to the sidebar and spend to /usage. Configurable through lib/dashboard-config.tsx (copy, starters, chat base path) and lib/dashboard-data.ts (what \"resume\" means). Pairs with the chat item for its /chat routes; install it first."
90
+ },
91
+ "artifacts": {
92
+ "title": "Artifacts",
93
+ "description": "Browse and manage AI-generated document artifacts: filterable list, full-content preview, copy-to-clipboard, and version delete, backed by the framework's document persistence service."
94
+ },
95
+ "privacy-settings": {
96
+ "title": "Privacy Settings",
97
+ "description": "GDPR-style data export, a read-only memory-audit trail, and per-category fact listing with delete, backed by the framework's identity service."
98
+ },
99
+ "chat": {
100
+ "title": "Chat",
101
+ "description": "A ChatGPT-level AI chat surface: a streaming thread with edit, regenerate and response versions, attachments, a model picker, reasoning, sources, tool cards and human-in-the-loop approvals, agent activity for Mastra and eve turns, a canvas beside the chat for documents a tool streams, a sidebar with pinned and dated groups, share links and feedback — on a two-line Route Handler that binds @intelligo-dev/chat's transport (auth, rate limit, feature gate, persistence, the execution boundary) to consumer-owned config (lib/chat-server-config.ts). Every tool renders through one entry in lib/chat-renderers.tsx, inline and in the canvas. Ships with a deterministic stub model so a clean install streams with no API keys. The config imports lib/intelligo.ts (the composition root) and lib/plans.ts, which are provided by the `intelligo create` scaffold, not by any registry item - in a hand-rolled app, create both before installing (see the CLI's app-scaffold templates)."
102
+ },
103
+ "chat-panel": {
104
+ "title": "Chat Panel",
105
+ "description": "The chat as a side panel on any page: a sheet that opens the same thread the chat page runs, with the page's context on every turn. Requires the chat item."
106
+ },
107
+ "chat-widget": {
108
+ "title": "Chat Widget",
109
+ "description": "The floating assistant: a launcher in a corner of every page and a compact chat over it, configured in lib/chat-widget-config.tsx. Requires the chat item."
110
+ },
111
+ "chat-share": {
112
+ "title": "Chat Share",
113
+ "description": "A conversation its owner published, readable by anyone with the link at /share/[id]: the same transcript, read-only, minus reasoning, tool details and attachments. Requires the chat item."
114
+ }
115
+ }
116
+ }
@@ -0,0 +1,180 @@
1
+ {
2
+ "$comment": "Machine-readable requirements of every registry item \u2014 what shadcn's schema cannot express. `scaffold`: consumer files `intelligo create` provides that items may import. Per item: `marker` (the file whose presence means the item is installed), `items` (sibling items that ship files this one imports \u2014 install them first), `files` (scaffold files it imports), `exports` (names a scaffold file must export), `features` (feature keys the item gates on; register them in lib/plans.ts). `seams`: files an item ships once and the deployment then owns, each with what it configures \u2014 `intelligo sync` never overwrites one, and message files (`messages/`) are merged key by key, the deployment's copy winning. tests/architecture/registry.test.ts asserts this file matches the code; CI derives the install order from it; `intelligo doctor` checks an app against it (packages/cli/templates/registry-requires.json is a copy the CLI build regenerates; the suite fails if it is stale).",
3
+ "scaffold": [
4
+ "lib/intelligo",
5
+ "lib/plans",
6
+ "lib/utils",
7
+ "hooks/use-mobile",
8
+ "i18n/routing",
9
+ "i18n/navigation"
10
+ ],
11
+ "seams": {
12
+ "lib/shell-config.tsx": "shell banner and header slots",
13
+ "lib/nav-config.ts": "navigation",
14
+ "lib/settings-nav.ts": "settings tabs",
15
+ "lib/error-reporting.ts": "the error reporter",
16
+ "lib/billing-config.ts": "product slug, currency, credit bundles",
17
+ "lib/feature-catalog.ts": "feature names and plans",
18
+ "lib/feature-gating-config.ts": "upgrade targets for gated features",
19
+ "lib/trial-banner-config.ts": "trial banner target and suppressed routes",
20
+ "lib/payment-poll-config.ts": "payment polling behaviour",
21
+ "lib/local-payment.ts": "the local payment provider",
22
+ "lib/onboarding-steps.ts": "onboarding steps",
23
+ "lib/dashboard-config.tsx": "dashboard copy",
24
+ "lib/dashboard-data.ts": "dashboard resume data",
25
+ "lib/document-patterns.ts": "artifact detection",
26
+ "lib/chat-model.ts": "the deployment's model",
27
+ "lib/chat-models.ts": "the models the composer offers",
28
+ "lib/chat-renderers.tsx": "tool-call renderers",
29
+ "lib/chat-canvas-config.tsx": "canvas editors per document kind",
30
+ "lib/chat-config.tsx": "agent identity, starters, header slot",
31
+ "lib/chat-server-config.ts": "the chat transport's configuration",
32
+ "lib/chat-widget-config.tsx": "the embedded widget",
33
+ "lib/notification-types.tsx": "icons for the product's notification types"
34
+ },
35
+ "items": {
36
+ "smoke": {
37
+ "marker": "app/[locale]/registry-smoke/page.tsx"
38
+ },
39
+ "route-error": {
40
+ "marker": "app/[locale]/(app)/error.tsx",
41
+ "files": ["i18n/navigation"]
42
+ },
43
+ "team-settings": {
44
+ "marker": "app/[locale]/(app)/settings/team/page.tsx",
45
+ "items": ["route-error"],
46
+ "files": ["i18n/navigation"]
47
+ },
48
+ "usage": {
49
+ "marker": "app/[locale]/(app)/usage/page.tsx",
50
+ "items": ["pricing", "route-error"],
51
+ "files": ["i18n/navigation"]
52
+ },
53
+ "invitation-accept": {
54
+ "marker": "app/[locale]/accept-invitation/[id]/page.tsx",
55
+ "items": ["team-settings"],
56
+ "files": ["i18n/navigation"]
57
+ },
58
+ "app-shell": {
59
+ "marker": "app/[locale]/(app)/layout.tsx",
60
+ "files": ["i18n/navigation", "lib/utils"]
61
+ },
62
+ "settings-shell": {
63
+ "marker": "app/[locale]/(app)/settings/layout.tsx",
64
+ "files": ["i18n/navigation"]
65
+ },
66
+ "workspace-settings": {
67
+ "marker": "app/[locale]/(app)/settings/workspace/page.tsx",
68
+ "items": ["route-error"],
69
+ "files": ["i18n/navigation"]
70
+ },
71
+ "auth-login": {
72
+ "marker": "app/[locale]/(auth)/layout.tsx",
73
+ "items": ["route-error"],
74
+ "files": ["i18n/navigation"]
75
+ },
76
+ "auth-signup": {
77
+ "marker": "app/[locale]/(auth)/signup/page.tsx",
78
+ "items": ["auth-login"],
79
+ "files": ["i18n/navigation"]
80
+ },
81
+ "auth-password-reset": {
82
+ "marker": "app/[locale]/(auth)/forgot-password/page.tsx",
83
+ "items": ["auth-login"],
84
+ "files": ["i18n/navigation"]
85
+ },
86
+ "auth-email-verification": {
87
+ "marker": "app/[locale]/(auth)/verify-email/page.tsx",
88
+ "items": ["auth-login"],
89
+ "files": ["i18n/navigation"]
90
+ },
91
+ "language-switcher": {
92
+ "marker": "components/layout/language-switcher.tsx",
93
+ "files": ["i18n/navigation", "i18n/routing"]
94
+ },
95
+ "trial-banner": {
96
+ "marker": "components/trial/trial-banner-container.tsx",
97
+ "files": ["i18n/navigation"]
98
+ },
99
+ "notifications": {
100
+ "marker": "app/[locale]/(app)/notifications/page.tsx",
101
+ "items": ["route-error"],
102
+ "files": ["i18n/navigation"]
103
+ },
104
+ "pricing": {
105
+ "marker": "app/[locale]/(app)/pricing/page.tsx",
106
+ "files": ["i18n/navigation"]
107
+ },
108
+ "checkout": {
109
+ "marker": "app/[locale]/(app)/checkout/success/page.tsx",
110
+ "files": ["i18n/navigation"]
111
+ },
112
+ "billing-settings": {
113
+ "marker": "app/[locale]/(app)/settings/billing/page.tsx",
114
+ "items": ["pricing", "route-error"],
115
+ "files": ["i18n/navigation"]
116
+ },
117
+ "feature-gating": {
118
+ "marker": "components/billing/feature-gate.tsx",
119
+ "items": ["pricing"],
120
+ "files": ["i18n/navigation", "lib/utils"]
121
+ },
122
+ "payment-poll": {
123
+ "marker": "components/billing/local-payment-modal.tsx",
124
+ "items": ["pricing"]
125
+ },
126
+ "profile-settings": {
127
+ "marker": "app/[locale]/(app)/settings/profile/page.tsx",
128
+ "items": ["route-error"],
129
+ "files": ["i18n/navigation", "i18n/routing"]
130
+ },
131
+ "onboarding": {
132
+ "marker": "app/[locale]/onboarding/layout.tsx",
133
+ "items": ["route-error"],
134
+ "files": ["i18n/navigation"]
135
+ },
136
+ "dashboard": {
137
+ "marker": "app/[locale]/(app)/dashboard/page.tsx",
138
+ "items": ["route-error"],
139
+ "files": ["i18n/navigation"]
140
+ },
141
+ "artifacts": {
142
+ "marker": "app/[locale]/(app)/artifacts/page.tsx",
143
+ "files": ["i18n/navigation"]
144
+ },
145
+ "privacy-settings": {
146
+ "marker": "app/[locale]/(app)/settings/privacy/page.tsx",
147
+ "items": ["route-error"]
148
+ },
149
+ "chat": {
150
+ "marker": "app/[locale]/(app)/chat/page.tsx",
151
+ "items": ["route-error"],
152
+ "files": [
153
+ "hooks/use-mobile",
154
+ "i18n/navigation",
155
+ "i18n/routing",
156
+ "lib/intelligo",
157
+ "lib/utils"
158
+ ],
159
+ "features": ["chat"],
160
+ "exports": {
161
+ "lib/intelligo": ["composeIntelligo", "executions"]
162
+ }
163
+ },
164
+ "chat-panel": {
165
+ "marker": "components/chat/chat-panel.tsx",
166
+ "items": ["chat"],
167
+ "files": ["lib/utils"]
168
+ },
169
+ "chat-widget": {
170
+ "marker": "components/chat/chat-widget.tsx",
171
+ "items": ["chat"],
172
+ "files": ["i18n/navigation", "lib/utils"]
173
+ },
174
+ "chat-share": {
175
+ "marker": "app/[locale]/share/[id]/page.tsx",
176
+ "items": ["chat"],
177
+ "files": ["i18n/navigation"]
178
+ }
179
+ }
180
+ }
@@ -1,22 +1,30 @@
1
1
  /**
2
- * Usage page — generated by `intelligo add usage-page`.
3
- *
4
- * This file is YOURS. Intelligo will not overwrite it: once you edit
5
- * it, `intelligo upgrade --check` reports the upstream change as a
6
- * diff and leaves your version alone (ADR-0002).
2
+ * Generated by `intelligo add usage-page` and never overwritten: once
3
+ * you edit it, `intelligo upgrade --check` reports a template change as
4
+ * a diff and leaves your version alone.
7
5
  *
8
6
  * It reads through @intelligo-dev/executions' query API rather than the
9
7
  * database directly, so it keeps working across schema changes.
10
8
  */
11
9
 
12
10
  import { requireWorkspace } from "@intelligo-dev/auth";
11
+ import { formatMoney, type Money } from "@intelligo-dev/core/money";
13
12
  import { listExecutions, summarizeExecutions } from "@intelligo-dev/executions";
14
13
 
14
+ /** Amounts arrive as micros with their currency; never assume a symbol. */
15
+ const show = (amounts: Money[]) =>
16
+ amounts.length === 0
17
+ ? "—"
18
+ : amounts.map((amount) => formatMoney(amount, "en-US")).join(" · ");
19
+
15
20
  export default async function UsagePage() {
16
21
  const { workspace } = await requireWorkspace();
17
22
 
18
23
  const now = new Date();
19
- const monthStart = new Date(now.getFullYear(), now.getMonth(), 1);
24
+ // Billing periods are UTC calendar months.
25
+ const monthStart = new Date(
26
+ Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), 1)
27
+ );
20
28
 
21
29
  const [summary, recent] = await Promise.all([
22
30
  summarizeExecutions(workspace.id, { from: monthStart, to: now }),
@@ -30,7 +38,7 @@ export default async function UsagePage() {
30
38
  <p>
31
39
  {summary.totals.count} executions this month ·{" "}
32
40
  {summary.totals.totalTokens.toLocaleString()} tokens ·{" "}
33
- {summary.totals.chargedMnt.toLocaleString()}₮
41
+ {show(summary.totals.charged)}
34
42
  </p>
35
43
 
36
44
  <table cellPadding={8}>
@@ -49,7 +57,14 @@ export default async function UsagePage() {
49
57
  <td>{e.capability}</td>
50
58
  <td>{e.status}</td>
51
59
  <td align="right">{e.totalTokens ?? 0}</td>
52
- <td align="right">{e.chargedMnt ?? 0}₮</td>
60
+ <td align="right">
61
+ {e.chargedMicros !== null && e.currency
62
+ ? formatMoney(
63
+ { amount: e.chargedMicros, currency: e.currency } as Money,
64
+ "en-US"
65
+ )
66
+ : "—"}
67
+ </td>
53
68
  <td>{e.startedAt.toISOString()}</td>
54
69
  </tr>
55
70
  ))}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Stands in for the `server-only` package under Vitest (vitest.config.ts
3
+ * aliases it here). The real module throws outside a `react-server`
4
+ * build, which would fail every test that imports server code on the
5
+ * guard instead of on what it tests.
6
+ */
7
+ export {};
@@ -0,0 +1,37 @@
1
+ import path from "node:path";
2
+ import { fileURLToPath } from "node:url";
3
+
4
+ import { defineConfig } from "vitest/config";
5
+
6
+ const root = path.dirname(fileURLToPath(import.meta.url));
7
+
8
+ /**
9
+ * The app's test runner.
10
+ *
11
+ * - `@` resolves the way the app's tsconfig resolves it.
12
+ * - `server-only` throws unless the bundler applies React's
13
+ * `react-server` condition, which a test does not; the stub stands in
14
+ * for it so a test can import server code.
15
+ * - The `@intelligo-dev/*` packages ship compiled ESM that imports
16
+ * `server-only` itself. Vitest leaves node_modules to Node, where the
17
+ * alias above never applies, so they are inlined: transformed by
18
+ * Vitest like the app's own source, with the alias in effect.
19
+ */
20
+ export default defineConfig({
21
+ resolve: {
22
+ alias: {
23
+ "@": root,
24
+ "server-only": path.join(root, "tests/stubs/server-only.ts"),
25
+ },
26
+ },
27
+ test: {
28
+ environment: "node",
29
+ include: ["**/*.test.{ts,tsx}"],
30
+ exclude: ["node_modules/**", ".next/**"],
31
+ server: {
32
+ deps: {
33
+ inline: [/node_modules\/@intelligo-dev\//],
34
+ },
35
+ },
36
+ },
37
+ });
@@ -1,72 +0,0 @@
1
- /**
2
- * Billing page — generated by `intelligo add billing-page`.
3
- *
4
- * Yours from here. It reads the plan catalogue your composition root
5
- * registered rather than a list baked into the framework, so changing
6
- * your prices is a change to your own `lib/plans.ts` (ADR-0006).
7
- */
8
-
9
- import { requireWorkspace } from "@intelligo-dev/auth";
10
- import { getWorkspaceBilling } from "@intelligo-dev/billing";
11
- import { getPlanConfigs } from "@intelligo-dev/billing/plans";
12
- import { CreditBalance } from "@intelligo-dev/ui";
13
-
14
- import { PRODUCT_SLUG } from "@/lib/intelligo";
15
-
16
- /**
17
- * Your currency, in one place. @intelligo-dev/ui takes a formatter rather
18
- * than assuming one, because a framework package deciding that money
19
- * is written "5,000₮" is wrong everywhere but here.
20
- */
21
- const formatAmount = (amount: number) => `${amount.toLocaleString()}₮`;
22
-
23
- export const dynamic = "force-dynamic";
24
-
25
- export default async function BillingPage() {
26
- const { workspace } = await requireWorkspace();
27
-
28
- const [billing, plans] = await Promise.all([
29
- getWorkspaceBilling(workspace.id),
30
- Promise.resolve(getPlanConfigs(PRODUCT_SLUG)),
31
- ]);
32
-
33
- const currentSlug = billing.plan?.slug ?? "free";
34
-
35
- return (
36
- <main style={{ fontFamily: "system-ui", padding: "2rem" }}>
37
- <h1>Billing</h1>
38
-
39
- <p>
40
- Current plan: <strong>{billing.plan?.name ?? "Free"}</strong>
41
- </p>
42
-
43
- <CreditBalance
44
- remainingMnt={billing.creditBalance.balanceMnt ?? 0}
45
- formatAmount={formatAmount}
46
- />
47
-
48
- <section>
49
- <h2>Plans</h2>
50
- {Object.values(plans).map((plan) => (
51
- <article key={plan.slug} style={{ marginBottom: "1.5rem" }}>
52
- <h3>
53
- {plan.name}
54
- {plan.slug === currentSlug ? " (current)" : ""}
55
- </h3>
56
- <p>{plan.description}</p>
57
- <p>
58
- {plan.priceOneTime === 0
59
- ? "Free"
60
- : formatAmount(plan.priceOneTime)}
61
- </p>
62
- <ul>
63
- {plan.features.map((f) => (
64
- <li key={f}>{f}</li>
65
- ))}
66
- </ul>
67
- </article>
68
- ))}
69
- </section>
70
- </main>
71
- );
72
- }