@intelligo-dev/cli 1.0.0-beta.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.
Files changed (65) hide show
  1. package/LICENSE +201 -0
  2. package/dist/bin.d.ts +14 -0
  3. package/dist/bin.d.ts.map +1 -0
  4. package/dist/bin.js +149 -0
  5. package/dist/bin.js.map +1 -0
  6. package/dist/commands/add.d.ts +48 -0
  7. package/dist/commands/add.d.ts.map +1 -0
  8. package/dist/commands/add.js +83 -0
  9. package/dist/commands/add.js.map +1 -0
  10. package/dist/commands/create.d.ts +33 -0
  11. package/dist/commands/create.d.ts.map +1 -0
  12. package/dist/commands/create.js +61 -0
  13. package/dist/commands/create.js.map +1 -0
  14. package/dist/commands/doctor.d.ts +23 -0
  15. package/dist/commands/doctor.d.ts.map +1 -0
  16. package/dist/commands/doctor.js +129 -0
  17. package/dist/commands/doctor.js.map +1 -0
  18. package/dist/commands/migrate-check.d.ts +44 -0
  19. package/dist/commands/migrate-check.d.ts.map +1 -0
  20. package/dist/commands/migrate-check.js +92 -0
  21. package/dist/commands/migrate-check.js.map +1 -0
  22. package/dist/commands/upgrade-check.d.ts +40 -0
  23. package/dist/commands/upgrade-check.d.ts.map +1 -0
  24. package/dist/commands/upgrade-check.js +91 -0
  25. package/dist/commands/upgrade-check.js.map +1 -0
  26. package/dist/index.d.ts +10 -0
  27. package/dist/index.d.ts.map +1 -0
  28. package/dist/index.js +10 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/manifest.d.ts +58 -0
  31. package/dist/manifest.d.ts.map +1 -0
  32. package/dist/manifest.js +65 -0
  33. package/dist/manifest.js.map +1 -0
  34. package/dist/migrations-dir.d.ts +13 -0
  35. package/dist/migrations-dir.d.ts.map +1 -0
  36. package/dist/migrations-dir.js +25 -0
  37. package/dist/migrations-dir.js.map +1 -0
  38. package/dist/migrations.d.ts +41 -0
  39. package/dist/migrations.d.ts.map +1 -0
  40. package/dist/migrations.js +99 -0
  41. package/dist/migrations.js.map +1 -0
  42. package/package.json +44 -0
  43. package/templates/admin-page/admin-page.tsx.tpl +56 -0
  44. package/templates/app-scaffold/assistant-route.ts.tpl +66 -0
  45. package/templates/app-scaffold/components.json.tpl +23 -0
  46. package/templates/app-scaffold/env.example.tpl +13 -0
  47. package/templates/app-scaffold/globals.css.tpl +329 -0
  48. package/templates/app-scaffold/i18n-navigation.ts.tpl +10 -0
  49. package/templates/app-scaffold/i18n-request.ts.tpl +51 -0
  50. package/templates/app-scaffold/i18n-routing.ts.tpl +13 -0
  51. package/templates/app-scaffold/intelligo.ts.tpl +84 -0
  52. package/templates/app-scaffold/layout.tsx.tpl +53 -0
  53. package/templates/app-scaffold/lib-utils.ts.tpl +6 -0
  54. package/templates/app-scaffold/messages-en-app.json.tpl +4 -0
  55. package/templates/app-scaffold/middleware.ts.tpl +11 -0
  56. package/templates/app-scaffold/next.config.mjs.tpl +19 -0
  57. package/templates/app-scaffold/package.json.tpl +42 -0
  58. package/templates/app-scaffold/plans.ts.tpl +43 -0
  59. package/templates/app-scaffold/postcss.config.mjs.tpl +7 -0
  60. package/templates/app-scaffold/sonner.tsx.tpl +50 -0
  61. package/templates/app-scaffold/theme-provider.tsx.tpl +28 -0
  62. package/templates/app-scaffold/tsconfig.json.tpl +12 -0
  63. package/templates/billing-page/billing-page.tsx.tpl +72 -0
  64. package/templates/manifest.json +116 -0
  65. package/templates/usage-page/usage-page.tsx.tpl +60 -0
@@ -0,0 +1,50 @@
1
+ "use client";
2
+
3
+ /**
4
+ * Toast host (shadcn's sonner wrapper) — mounted once by
5
+ * `app/[locale]/layout.tsx`. Registry items call `toast(...)` from the
6
+ * `sonner` package and rely on this being mounted; without it their
7
+ * toasts silently never render.
8
+ *
9
+ * This is the stock shadcn `sonner` component; `pnpm dlx shadcn add
10
+ * sonner` would produce the same file at the same path.
11
+ */
12
+
13
+ import {
14
+ CircleCheckIcon,
15
+ InfoIcon,
16
+ Loader2Icon,
17
+ OctagonXIcon,
18
+ TriangleAlertIcon,
19
+ } from "lucide-react";
20
+ import { useTheme } from "next-themes";
21
+ import { Toaster as Sonner, type ToasterProps } from "sonner";
22
+
23
+ const Toaster = ({ ...props }: ToasterProps) => {
24
+ const { theme = "system" } = useTheme();
25
+
26
+ return (
27
+ <Sonner
28
+ theme={theme as ToasterProps["theme"]}
29
+ className="toaster group"
30
+ icons={{
31
+ success: <CircleCheckIcon className="size-4" />,
32
+ info: <InfoIcon className="size-4" />,
33
+ warning: <TriangleAlertIcon className="size-4" />,
34
+ error: <OctagonXIcon className="size-4" />,
35
+ loading: <Loader2Icon className="size-4 animate-spin" />,
36
+ }}
37
+ style={
38
+ {
39
+ "--normal-bg": "var(--popover)",
40
+ "--normal-text": "var(--popover-foreground)",
41
+ "--normal-border": "var(--border)",
42
+ "--border-radius": "var(--radius)",
43
+ } as React.CSSProperties
44
+ }
45
+ {...props}
46
+ />
47
+ );
48
+ };
49
+
50
+ export { Toaster };
@@ -0,0 +1,28 @@
1
+ "use client";
2
+
3
+ /**
4
+ * Theme provider — mounted by `app/[locale]/layout.tsx` so any theme
5
+ * switcher (e.g. the app-shell item's user menu) actually works.
6
+ *
7
+ * The same file ships with the `app-shell` registry item at the same
8
+ * path; installing app-shell simply overwrites this copy with an
9
+ * identical one. Defaults: class-attribute strategy (Tailwind's `.dark`
10
+ * tokens), system preference honored, no transition flash on switch.
11
+ */
12
+
13
+ import { ThemeProvider as NextThemesProvider } from "next-themes";
14
+ import type { ThemeProviderProps } from "next-themes";
15
+
16
+ export function ThemeProvider({ children, ...props }: ThemeProviderProps) {
17
+ return (
18
+ <NextThemesProvider
19
+ attribute="class"
20
+ defaultTheme="system"
21
+ enableSystem
22
+ disableTransitionOnChange
23
+ {...props}
24
+ >
25
+ {children}
26
+ </NextThemesProvider>
27
+ );
28
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "lib": ["dom", "dom.iterable", "esnext"],
5
+ "jsx": "preserve",
6
+ "noEmit": true,
7
+ "plugins": [{ "name": "next" }],
8
+ "paths": { "@/*": ["./*"] }
9
+ },
10
+ "include": ["**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
11
+ "exclude": ["node_modules", ".next"]
12
+ }
@@ -0,0 +1,72 @@
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
+ }
@@ -0,0 +1,116 @@
1
+ {
2
+ "usage-page": {
3
+ "templateVersion": "1.0.0",
4
+ "description": "A usage page listing executions and cost for the current workspace",
5
+ "files": [
6
+ {
7
+ "template": "usage-page/usage-page.tsx.tpl",
8
+ "target": "app/usage/page.tsx"
9
+ }
10
+ ],
11
+ "deprecated": "Superseded by the `usage` registry item \u2014 install it with the shadcn CLI from the Intelligo registry instead; it ships a full page, components and thin actions as consumer-owned source."
12
+ },
13
+ "app-scaffold": {
14
+ "templateVersion": "1.4.0",
15
+ "description": "A new application: composition root, plans, an assistant route, config, next-intl i18n plumbing, and a registry-consuming shadcn/Tailwind setup",
16
+ "files": [
17
+ {
18
+ "template": "app-scaffold/package.json.tpl",
19
+ "target": "package.json"
20
+ },
21
+ {
22
+ "template": "app-scaffold/next.config.mjs.tpl",
23
+ "target": "next.config.mjs"
24
+ },
25
+ {
26
+ "template": "app-scaffold/tsconfig.json.tpl",
27
+ "target": "tsconfig.json"
28
+ },
29
+ {
30
+ "template": "app-scaffold/env.example.tpl",
31
+ "target": ".env.example"
32
+ },
33
+ {
34
+ "template": "app-scaffold/intelligo.ts.tpl",
35
+ "target": "lib/intelligo.ts"
36
+ },
37
+ {
38
+ "template": "app-scaffold/plans.ts.tpl",
39
+ "target": "lib/plans.ts"
40
+ },
41
+ {
42
+ "template": "app-scaffold/assistant-route.ts.tpl",
43
+ "target": "app/api/assistant/route.ts"
44
+ },
45
+ {
46
+ "template": "app-scaffold/components.json.tpl",
47
+ "target": "components.json"
48
+ },
49
+ {
50
+ "template": "app-scaffold/postcss.config.mjs.tpl",
51
+ "target": "postcss.config.mjs"
52
+ },
53
+ {
54
+ "template": "app-scaffold/globals.css.tpl",
55
+ "target": "app/globals.css"
56
+ },
57
+ {
58
+ "template": "app-scaffold/lib-utils.ts.tpl",
59
+ "target": "lib/utils.ts"
60
+ },
61
+ {
62
+ "template": "app-scaffold/layout.tsx.tpl",
63
+ "target": "app/[locale]/layout.tsx"
64
+ },
65
+ {
66
+ "template": "app-scaffold/theme-provider.tsx.tpl",
67
+ "target": "components/shell/theme-provider.tsx"
68
+ },
69
+ {
70
+ "template": "app-scaffold/sonner.tsx.tpl",
71
+ "target": "components/ui/sonner.tsx"
72
+ },
73
+ {
74
+ "template": "app-scaffold/i18n-routing.ts.tpl",
75
+ "target": "i18n/routing.ts"
76
+ },
77
+ {
78
+ "template": "app-scaffold/i18n-navigation.ts.tpl",
79
+ "target": "i18n/navigation.ts"
80
+ },
81
+ {
82
+ "template": "app-scaffold/i18n-request.ts.tpl",
83
+ "target": "i18n/request.ts"
84
+ },
85
+ {
86
+ "template": "app-scaffold/middleware.ts.tpl",
87
+ "target": "middleware.ts"
88
+ },
89
+ {
90
+ "template": "app-scaffold/messages-en-app.json.tpl",
91
+ "target": "messages/en/app.json"
92
+ }
93
+ ]
94
+ },
95
+ "billing-page": {
96
+ "templateVersion": "1.0.0",
97
+ "description": "A billing page reading your registered plan catalogue",
98
+ "files": [
99
+ {
100
+ "template": "billing-page/billing-page.tsx.tpl",
101
+ "target": "app/billing/page.tsx"
102
+ }
103
+ ],
104
+ "deprecated": "Superseded by the `pricing` and `billing-settings` registry items \u2014 install them with the shadcn CLI from the Intelligo registry instead."
105
+ },
106
+ "admin-page": {
107
+ "templateVersion": "1.0.0",
108
+ "description": "Mount the Intelligo operational console at /admin",
109
+ "files": [
110
+ {
111
+ "template": "admin-page/admin-page.tsx.tpl",
112
+ "target": "app/admin/page.tsx"
113
+ }
114
+ ]
115
+ }
116
+ }
@@ -0,0 +1,60 @@
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).
7
+ *
8
+ * It reads through @intelligo-dev/executions' query API rather than the
9
+ * database directly, so it keeps working across schema changes.
10
+ */
11
+
12
+ import { requireWorkspace } from "@intelligo-dev/auth";
13
+ import { listExecutions, summarizeExecutions } from "@intelligo-dev/executions";
14
+
15
+ export default async function UsagePage() {
16
+ const { workspace } = await requireWorkspace();
17
+
18
+ const now = new Date();
19
+ const monthStart = new Date(now.getFullYear(), now.getMonth(), 1);
20
+
21
+ const [summary, recent] = await Promise.all([
22
+ summarizeExecutions(workspace.id, { from: monthStart, to: now }),
23
+ listExecutions({ workspaceId: workspace.id, limit: 20 }),
24
+ ]);
25
+
26
+ return (
27
+ <main style={{ fontFamily: "system-ui", padding: "2rem" }}>
28
+ <h1>Usage</h1>
29
+
30
+ <p>
31
+ {summary.totals.count} executions this month ·{" "}
32
+ {summary.totals.totalTokens.toLocaleString()} tokens ·{" "}
33
+ {summary.totals.chargedMnt.toLocaleString()}₮
34
+ </p>
35
+
36
+ <table cellPadding={8}>
37
+ <thead>
38
+ <tr>
39
+ <th align="left">Capability</th>
40
+ <th align="left">Status</th>
41
+ <th align="right">Tokens</th>
42
+ <th align="right">Charged</th>
43
+ <th align="left">Started</th>
44
+ </tr>
45
+ </thead>
46
+ <tbody>
47
+ {recent.map((e) => (
48
+ <tr key={e.id}>
49
+ <td>{e.capability}</td>
50
+ <td>{e.status}</td>
51
+ <td align="right">{e.totalTokens ?? 0}</td>
52
+ <td align="right">{e.chargedMnt ?? 0}₮</td>
53
+ <td>{e.startedAt.toISOString()}</td>
54
+ </tr>
55
+ ))}
56
+ </tbody>
57
+ </table>
58
+ </main>
59
+ );
60
+ }