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

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 (103) hide show
  1. package/NOTICE +6 -0
  2. package/README.md +63 -0
  3. package/dist/bin.js +85 -37
  4. package/dist/bin.js.map +1 -1
  5. package/dist/commands/add.d.ts +22 -1
  6. package/dist/commands/add.d.ts.map +1 -1
  7. package/dist/commands/add.js +61 -4
  8. package/dist/commands/add.js.map +1 -1
  9. package/dist/commands/create-flow.d.ts +34 -0
  10. package/dist/commands/create-flow.d.ts.map +1 -0
  11. package/dist/commands/create-flow.js +180 -0
  12. package/dist/commands/create-flow.js.map +1 -0
  13. package/dist/commands/create.d.ts +23 -6
  14. package/dist/commands/create.d.ts.map +1 -1
  15. package/dist/commands/create.js +45 -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 +293 -37
  20. package/dist/commands/doctor.js.map +1 -1
  21. package/dist/commands/migrate-check.d.ts +54 -1
  22. package/dist/commands/migrate-check.d.ts.map +1 -1
  23. package/dist/commands/migrate-check.js +101 -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 +147 -0
  28. package/dist/commands/migrate.js.map +1 -0
  29. package/dist/commands/upgrade-check.d.ts +5 -5
  30. package/dist/commands/upgrade-check.d.ts.map +1 -1
  31. package/dist/commands/upgrade-check.js +19 -6
  32. package/dist/commands/upgrade-check.js.map +1 -1
  33. package/dist/env-files.d.ts +12 -0
  34. package/dist/env-files.d.ts.map +1 -0
  35. package/dist/env-files.js +29 -0
  36. package/dist/env-files.js.map +1 -0
  37. package/dist/index.d.ts +9 -0
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +9 -0
  40. package/dist/index.js.map +1 -1
  41. package/dist/manifest.d.ts +9 -15
  42. package/dist/manifest.d.ts.map +1 -1
  43. package/dist/manifest.js +5 -16
  44. package/dist/manifest.js.map +1 -1
  45. package/dist/migrations.d.ts +3 -6
  46. package/dist/migrations.d.ts.map +1 -1
  47. package/dist/migrations.js +3 -6
  48. package/dist/migrations.js.map +1 -1
  49. package/dist/model-catalogue.d.ts +14 -0
  50. package/dist/model-catalogue.d.ts.map +1 -0
  51. package/dist/model-catalogue.js +34 -0
  52. package/dist/model-catalogue.js.map +1 -0
  53. package/dist/registry-items.d.ts +56 -0
  54. package/dist/registry-items.d.ts.map +1 -0
  55. package/dist/registry-items.js +103 -0
  56. package/dist/registry-items.js.map +1 -0
  57. package/package.json +36 -10
  58. package/src/bin.ts +264 -0
  59. package/src/commands/add.ts +244 -0
  60. package/src/commands/create-flow.ts +228 -0
  61. package/src/commands/create.ts +139 -0
  62. package/src/commands/doctor.ts +487 -0
  63. package/src/commands/migrate-check.ts +257 -0
  64. package/src/commands/migrate.ts +234 -0
  65. package/src/commands/upgrade-check.ts +157 -0
  66. package/src/env-files.ts +31 -0
  67. package/src/index.ts +39 -0
  68. package/src/manifest.ts +93 -0
  69. package/src/migrations-dir.ts +25 -0
  70. package/src/migrations.ts +133 -0
  71. package/src/model-catalogue.ts +35 -0
  72. package/src/registry-items.ts +132 -0
  73. package/templates/admin-page/admin-page.tsx.tpl +2 -3
  74. package/templates/app-scaffold/assistant-route.ts.tpl +2 -2
  75. package/templates/app-scaffold/auth-route.ts.tpl +10 -0
  76. package/templates/app-scaffold/components.json.tpl +6 -2
  77. package/templates/app-scaffold/db-schema.ts.tpl +29 -0
  78. package/templates/app-scaffold/drizzle-journal.json.tpl +5 -0
  79. package/templates/app-scaffold/drizzle.config.ts.tpl +45 -0
  80. package/templates/app-scaffold/env.example.tpl +65 -1
  81. package/templates/app-scaffold/globals.css.tpl +172 -281
  82. package/templates/app-scaffold/i18n-request.ts.tpl +25 -0
  83. package/templates/app-scaffold/instrumentation.ts.tpl +21 -0
  84. package/templates/app-scaffold/intelligo.ts.tpl +104 -9
  85. package/templates/app-scaffold/layout.tsx.tpl +18 -1
  86. package/templates/app-scaffold/lib-utils.ts.tpl +1 -6
  87. package/templates/app-scaffold/next.config.mjs.tpl +2 -0
  88. package/templates/app-scaffold/package.json.tpl +31 -17
  89. package/templates/app-scaffold/page.tsx.tpl +16 -0
  90. package/templates/app-scaffold/plans.ts.tpl +32 -13
  91. package/templates/app-scaffold/{middleware.ts.tpl → proxy.ts.tpl} +6 -0
  92. package/templates/app-scaffold/sonner.tsx.tpl +42 -20
  93. package/templates/app-scaffold/stripe-webhook-route.ts.tpl +24 -0
  94. package/templates/app-scaffold/theme-provider.tsx.tpl +6 -4
  95. package/templates/app-scaffold/tsconfig.json.tpl +20 -4
  96. package/templates/app-scaffold/use-mobile.ts.tpl +19 -0
  97. package/templates/app-scaffold/workspace-bootstrap.ts.tpl +30 -0
  98. package/templates/maintenance/maintenance-route.ts.tpl +119 -0
  99. package/templates/manifest.json +57 -18
  100. package/templates/registry-items.json +116 -0
  101. package/templates/registry-requires.json +156 -0
  102. package/templates/usage-page/usage-page.tsx.tpl +23 -8
  103. package/templates/billing-page/billing-page.tsx.tpl +0 -72
@@ -1 +1 @@
1
- {"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../src/migrations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,oEAAoE;IACpE,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,sDAAsD;IACtD,WAAW,EAAE,MAAM,E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* Drizzle keeps two sources of truth: the `.sql` files on disk and
5
5
  * `meta/_journal.json`, which is what `drizzle-kit migrate` actually
6
- * reads. Nothing keeps them in step. In this repo the journal stopped
7
- * at entry 11 while 39 files accumulated, so `migrate` silently
8
- * applied a quarter of the chain and every environment was really
9
- * provisioned by `drizzle-kit push` from `schema.ts` instead — which
10
- * is how a migration shipped documenting a unique constraint on a
11
- * column no migration created.
6
+ * reads. Nothing keeps them in step: a file missing from the journal is
7
+ * silently skipped by `migrate`, while `drizzle-kit push` from
8
+ * `schema.ts` hides the gap.
12
9
  *
13
10
  * The drift is invisible until someone provisions a database from the
14
11
  * migrations, at which point it is a production incident rather than a
@@ -1 +1 @@
1
- {"version":3,"file":"migrations.js","sourceRoot":"","sources":["../src/migrations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,IAAI,MAAM,WAAW,CAAC;AAsB7B,SAAS,KAAK,CAAC,IAAY;IACzB,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,GAAW;IAC5C,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC;SAC3B,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;SACjC,IAAI,EAAE,CAAC;IAEV,IAAI,WAAW,GAAa,EAAE,CAAC;IAC/B,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CACxB,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,MAAM,CAAC,CAC9B,CAAC;QAClC,WAAW,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE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C;QAC5B,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAE,CAAC;QACvB,IAAI,GAAG,GAAG,IAAI,GAAG,CAAC,EAAE,CAAC;YACnB,QAAQ,CAAC,IAAI,CAAC;gBACZ,KAAK,EAAE,MAAM;gBACb,OAAO,EAAE,+BAA+B,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,MAAM,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE;aAC1G,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Where the shipped model catalogue (`DEFAULT_MODELS`) can be read from,
3
+ * relative to the directory the CLI is run from: the framework
4
+ * repository's own source, then the installed package's source, then
5
+ * its build. The CLI reads the file rather than importing the package,
6
+ * so `doctor` works in an app whose dependencies do not even load.
7
+ */
8
+ export declare const MODEL_CATALOGUE_LOCATIONS: readonly ["packages/executions/src/pricing.ts", "node_modules/@intelligo-dev/executions/src/pricing.ts", "node_modules/@intelligo-dev/executions/dist/pricing.js"];
9
+ /**
10
+ * The ids `DEFAULT_MODELS` prices, or null when no catalogue file is
11
+ * found or the declaration is not in it.
12
+ */
13
+ export declare function readCatalogueModelIds(root: string): Set<string> | null;
14
+ //# sourceMappingURL=model-catalogue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-catalogue.d.ts","sourceRoot":"","sources":["../src/model-catalogue.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,oKAI5B,CAAC;AAEX;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CActE"}
@@ -0,0 +1,34 @@
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import path from "node:path";
3
+ /**
4
+ * Where the shipped model catalogue (`DEFAULT_MODELS`) can be read from,
5
+ * relative to the directory the CLI is run from: the framework
6
+ * repository's own source, then the installed package's source, then
7
+ * its build. The CLI reads the file rather than importing the package,
8
+ * so `doctor` works in an app whose dependencies do not even load.
9
+ */
10
+ export const MODEL_CATALOGUE_LOCATIONS = [
11
+ "packages/executions/src/pricing.ts",
12
+ "node_modules/@intelligo-dev/executions/src/pricing.ts",
13
+ "node_modules/@intelligo-dev/executions/dist/pricing.js",
14
+ ];
15
+ /**
16
+ * The ids `DEFAULT_MODELS` prices, or null when no catalogue file is
17
+ * found or the declaration is not in it.
18
+ */
19
+ export function readCatalogueModelIds(root) {
20
+ for (const relative of MODEL_CATALOGUE_LOCATIONS) {
21
+ const file = path.join(root, relative);
22
+ if (!existsSync(file))
23
+ continue;
24
+ const text = readFileSync(file, "utf8");
25
+ const start = text.indexOf("export const DEFAULT_MODELS");
26
+ if (start === -1)
27
+ continue;
28
+ return new Set([
29
+ ...text.slice(start).matchAll(/\bid:\s*"([a-z0-9-]+\/[a-z0-9._-]+)"/g),
30
+ ].map((m) => m[1]));
31
+ }
32
+ return null;
33
+ }
34
+ //# sourceMappingURL=model-catalogue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-catalogue.js","sourceRoot":"","sources":["../src/model-catalogue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,oCAAoC;IACpC,uDAAuD;IACvD,wDAAwD;CAChD,CAAC;AAEX;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAAY;IAChD,KAAK,MAAM,QAAQ,IAAI,yBAAyB,EAAE,CAAC;QACjD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACvC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YAAE,SAAS;QAChC,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACxC,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,6BAA6B,CAAC,CAAC;QAC1D,IAAI,KAAK,KAAK,CAAC,CAAC;YAAE,SAAS;QAC3B,OAAO,IAAI,GAAG,CACZ;YACE,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,uCAAuC,CAAC;SACvE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAE,CAAC,CACpB,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * The registry's pages as `intelligo create` offers them: what each one
3
+ * is, what else it needs installed first, and the commands that install
4
+ * a selection into a fresh app.
5
+ *
6
+ * Installing is the shadcn CLI's job, not this package's — the items
7
+ * are shadcn-schema JSON served at intelligo.dev/r, and the scaffold's
8
+ * components.json already names that registry as `@intelligo`. What the
9
+ * CLI adds is the order: an item that imports a sibling's files
10
+ * (requires.json `items`) has to land after it.
11
+ */
12
+ import type { RegistryRequires } from "./commands/doctor.js";
13
+ export type RegistryItem = {
14
+ title: string;
15
+ description: string;
16
+ };
17
+ export type RegistryCatalogue = {
18
+ items: Record<string, RegistryItem>;
19
+ requires: RegistryRequires;
20
+ };
21
+ /** Both files are build-time copies from packages/registry (see scripts/). */
22
+ export declare function readRegistryCatalogue(templatesDir: string): RegistryCatalogue;
23
+ /** The description's opening clause — short enough for one picker line. */
24
+ export declare function shortDescription(description: string, max?: number): string;
25
+ /**
26
+ * The selection plus everything it depends on, dependencies first.
27
+ * Unknown names throw rather than being dropped: a typo in `--items`
28
+ * should not quietly install less than was asked for.
29
+ */
30
+ export declare function withDependencies(selected: readonly string[], requires: RegistryRequires): string[];
31
+ export type PackageManager = "pnpm" | "npm" | "yarn" | "bun";
32
+ /**
33
+ * Whichever manager ran the CLI (`pnpm dlx`, `npx`, `bunx`… all set
34
+ * npm_config_user_agent), else pnpm — the one the scaffold documents.
35
+ */
36
+ export declare function detectPackageManager(userAgent?: string | undefined): PackageManager;
37
+ export type Command = {
38
+ command: string;
39
+ args: string[];
40
+ };
41
+ export declare function formatCommand(c: Command): string;
42
+ /** Whether the app has its own shadcn binary, i.e. dependencies are installed. */
43
+ export declare function hasLocalShadcn(appRoot: string): boolean;
44
+ /**
45
+ * The commands that put `items` into the app at `appRoot`: install the
46
+ * dependencies when shadcn is not there yet (the scaffold declares it),
47
+ * then the design-system base, then the items in dependency order.
48
+ * `--overwrite` because the base replaces the scaffold's globals.css,
49
+ * and items that share a file agree on it — the same flags the
50
+ * reference app is regenerated with.
51
+ */
52
+ export declare function installPlan(items: readonly string[], options: {
53
+ appRoot: string;
54
+ packageManager: PackageManager;
55
+ }): Command[];
56
+ //# sourceMappingURL=registry-items.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry-items.d.ts","sourceRoot":"","sources":["../src/registry-items.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,MAAM,MAAM,YAAY,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC;AAClE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACpC,QAAQ,EAAE,gBAAgB,CAAC;CAC5B,CAAC;AAEF,8EAA8E;AAC9E,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,MAAM,GAAG,iBAAiB,CAS7E;AAED,2EAA2E;AAC3E,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,SAAK,GAAG,MAAM,CAGtE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,QAAQ,EAAE,gBAAgB,GACzB,MAAM,EAAE,CAiBV;AAED,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,CAAC;AAE7D;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,GAAE,MAAM,GAAG,SAA6C,GAChE,cAAc,CAGhB;AAED,MAAM,MAAM,OAAO,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAE1D,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,CAEhD;AASD,kFAAkF;AAClF,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,OAAO,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,cAAc,CAAA;CAAE,GAC3D,OAAO,EAAE,CAqBX"}
@@ -0,0 +1,103 @@
1
+ /**
2
+ * The registry's pages as `intelligo create` offers them: what each one
3
+ * is, what else it needs installed first, and the commands that install
4
+ * a selection into a fresh app.
5
+ *
6
+ * Installing is the shadcn CLI's job, not this package's — the items
7
+ * are shadcn-schema JSON served at intelligo.dev/r, and the scaffold's
8
+ * components.json already names that registry as `@intelligo`. What the
9
+ * CLI adds is the order: an item that imports a sibling's files
10
+ * (requires.json `items`) has to land after it.
11
+ */
12
+ import { existsSync, readFileSync } from "node:fs";
13
+ import path from "node:path";
14
+ /** Both files are build-time copies from packages/registry (see scripts/). */
15
+ export function readRegistryCatalogue(templatesDir) {
16
+ const read = (file) => JSON.parse(readFileSync(path.join(templatesDir, file), "utf8"));
17
+ return {
18
+ items: read("registry-items.json").items,
19
+ requires: read("registry-requires.json"),
20
+ };
21
+ }
22
+ /** The description's opening clause — short enough for one picker line. */
23
+ export function shortDescription(description, max = 64) {
24
+ const head = description.split(/[:.]\s|\s—\s/)[0].trim();
25
+ return head.length <= max ? head : `${head.slice(0, max - 1).trimEnd()}…`;
26
+ }
27
+ /**
28
+ * The selection plus everything it depends on, dependencies first.
29
+ * Unknown names throw rather than being dropped: a typo in `--items`
30
+ * should not quietly install less than was asked for.
31
+ */
32
+ export function withDependencies(selected, requires) {
33
+ const order = [];
34
+ const seen = new Set();
35
+ const visit = (name) => {
36
+ if (seen.has(name))
37
+ return;
38
+ const entry = requires.items[name];
39
+ if (!entry) {
40
+ throw new Error(`Unknown registry item "${name}". Available: ${Object.keys(requires.items).join(", ")}`);
41
+ }
42
+ seen.add(name);
43
+ for (const dependency of entry.items ?? [])
44
+ visit(dependency);
45
+ order.push(name);
46
+ };
47
+ for (const name of selected)
48
+ visit(name);
49
+ return order;
50
+ }
51
+ /**
52
+ * Whichever manager ran the CLI (`pnpm dlx`, `npx`, `bunx`… all set
53
+ * npm_config_user_agent), else pnpm — the one the scaffold documents.
54
+ */
55
+ export function detectPackageManager(userAgent = process.env.npm_config_user_agent) {
56
+ const name = userAgent?.split("/")[0];
57
+ return name === "npm" || name === "yarn" || name === "bun" ? name : "pnpm";
58
+ }
59
+ export function formatCommand(c) {
60
+ return [c.command, ...c.args].join(" ");
61
+ }
62
+ const EXEC = {
63
+ pnpm: ["pnpm", "exec"],
64
+ npm: ["npx"],
65
+ yarn: ["yarn"],
66
+ bun: ["bunx"],
67
+ };
68
+ /** Whether the app has its own shadcn binary, i.e. dependencies are installed. */
69
+ export function hasLocalShadcn(appRoot) {
70
+ return existsSync(path.join(appRoot, "node_modules", ".bin", "shadcn"));
71
+ }
72
+ /**
73
+ * The commands that put `items` into the app at `appRoot`: install the
74
+ * dependencies when shadcn is not there yet (the scaffold declares it),
75
+ * then the design-system base, then the items in dependency order.
76
+ * `--overwrite` because the base replaces the scaffold's globals.css,
77
+ * and items that share a file agree on it — the same flags the
78
+ * reference app is regenerated with.
79
+ */
80
+ export function installPlan(items, options) {
81
+ if (items.length === 0)
82
+ return [];
83
+ const [command, ...exec] = EXEC[options.packageManager];
84
+ const add = (names) => ({
85
+ command: command,
86
+ args: [
87
+ ...exec,
88
+ "shadcn",
89
+ "add",
90
+ ...names.map((n) => `@intelligo/${n}`),
91
+ "--yes",
92
+ "--overwrite",
93
+ ],
94
+ });
95
+ return [
96
+ ...(hasLocalShadcn(options.appRoot)
97
+ ? []
98
+ : [{ command: options.packageManager, args: ["install"] }]),
99
+ add(["intelligo"]),
100
+ add([...items]),
101
+ ];
102
+ }
103
+ //# sourceMappingURL=registry-items.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry-items.js","sourceRoot":"","sources":["../src/registry-items.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,IAAI,MAAM,WAAW,CAAC;AAU7B,8EAA8E;AAC9E,MAAM,UAAU,qBAAqB,CAAC,YAAoB;IACxD,MAAM,IAAI,GAAG,CAAC,IAAY,EAAE,EAAE,CAC5B,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IAClE,OAAO;QACL,KAAK,EACH,IAAI,CAAC,qBAAqB,CAC3B,CAAC,KAAK;QACP,QAAQ,EAAE,IAAI,CAAC,wBAAwB,CAAqB;KAC7D,CAAC;AACJ,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,gBAAgB,CAAC,WAAmB,EAAE,GAAG,GAAG,EAAE;IAC5D,MAAM,IAAI,GAAG,WAAW,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,CAAE,CAAC,IAAI,EAAE,CAAC;IAC1D,OAAO,IAAI,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,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AAc,EAAE,IAAI,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QAC7D,GAAG,CAAC,CAAC,WAAW,CAAC,CAAC;QAClB,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC;KAChB,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,15 +1,28 @@
1
1
  {
2
2
  "name": "@intelligo-dev/cli",
3
- "version": "1.0.0-beta.1",
3
+ "version": "1.0.0-beta.13",
4
+ "description": "The Intelligo CLI: scaffold an AI SaaS app, generate owned source, and check its migrations and upgrades.",
5
+ "keywords": [
6
+ "intelligo",
7
+ "ai-saas",
8
+ "saas",
9
+ "typescript",
10
+ "cli",
11
+ "scaffold",
12
+ "shadcn",
13
+ "migrations",
14
+ "nextjs"
15
+ ],
4
16
  "license": "Apache-2.0",
17
+ "author": "Turtuvshin Byambaa <toroo.byamba@gmail.com>",
5
18
  "repository": {
6
19
  "type": "git",
7
- "url": "git+https://github.com/intelligo-mn/framework.git",
20
+ "url": "git+https://github.com/intelligo-dev/intelligo.git",
8
21
  "directory": "packages/cli"
9
22
  },
10
- "homepage": "https://github.com/intelligo-mn/framework#readme",
23
+ "homepage": "https://intelligo.dev/docs/packages/cli",
11
24
  "bugs": {
12
- "url": "https://github.com/intelligo-mn/framework/issues"
25
+ "url": "https://github.com/intelligo-dev/intelligo/issues"
13
26
  },
14
27
  "type": "module",
15
28
  "bin": {
@@ -22,23 +35,36 @@
22
35
  }
23
36
  },
24
37
  "dependencies": {
25
- "pg": "^8.18.0"
38
+ "@clack/prompts": "^1.8.1",
39
+ "pg": "8.18.0"
26
40
  },
27
41
  "devDependencies": {
28
- "@types/node": "^22.0.0",
29
- "@types/pg": "^8.16.0",
30
- "typescript": "^5.7.2"
42
+ "@types/node": "^26.6.1",
43
+ "@types/pg": "^8.23.1",
44
+ "typescript": "^5.9.3"
31
45
  },
32
46
  "files": [
33
47
  "dist",
34
- "templates"
48
+ "src",
49
+ "!src/**/*.test.ts",
50
+ "!src/**/*.test.tsx",
51
+ "!src/**/__tests__/**",
52
+ "templates",
53
+ "LICENSE",
54
+ "NOTICE",
55
+ "README.md",
56
+ "!dist/**/*.tsbuildinfo"
35
57
  ],
36
58
  "publishConfig": {
37
59
  "access": "public"
38
60
  },
61
+ "engines": {
62
+ "node": ">=22.14"
63
+ },
64
+ "sideEffects": false,
39
65
  "scripts": {
40
66
  "type-check": "tsc --noEmit",
41
67
  "lint": "eslint .",
42
- "build": "tsc -p tsconfig.build.json"
68
+ "build": "node scripts/sync-registry-requires.mjs && tsc -p tsconfig.build.json && node ../../scripts/fix-esm-extensions.mjs dist"
43
69
  }
44
70
  }
package/src/bin.ts ADDED
@@ -0,0 +1,264 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * intelligo <command>
4
+ *
5
+ * The shebang targets node because that is what runs the *published*
6
+ * binary from dist/. In this workspace the source is run with
7
+ * `pnpm exec tsx packages/cli/src/bin.ts`.
8
+ *
9
+ * Deliberately tiny: the commands are library functions, and this file
10
+ * only maps argv onto them, opens a database connection when one is
11
+ * needed, and picks an exit code.
12
+ */
13
+
14
+ import { createRequire } from "node:module";
15
+ import path from "node:path";
16
+ import { fileURLToPath } from "node:url";
17
+
18
+ import {
19
+ addFeature,
20
+ formatAddResult,
21
+ addExitCode,
22
+ readCatalogue,
23
+ } from "./commands/add.js";
24
+ import { exitCodeFor, formatResults, runChecks } from "./commands/doctor.js";
25
+ import {
26
+ formatMigrateCheck,
27
+ formatMigrateCheckJson,
28
+ migrateCheck,
29
+ migrateCheckExitCode,
30
+ } from "./commands/migrate-check.js";
31
+ import {
32
+ MIGRATIONS_TABLE_SQL,
33
+ SCHEMA_PROBE_SQL,
34
+ applyExitCode,
35
+ applyMigrations,
36
+ formatApplyResult,
37
+ } from "./commands/migrate.js";
38
+ import {
39
+ formatUpgradeReport,
40
+ upgradeCheck,
41
+ upgradeCheckExitCode,
42
+ } from "./commands/upgrade-check.js";
43
+
44
+ import { loadAppEnv } from "./env-files.js";
45
+ import { MIGRATION_LOCATIONS, resolveMigrationsDir } from "./migrations-dir.js";
46
+
47
+ /**
48
+ * Templates ship with the CLI package.
49
+ *
50
+ * `fileURLToPath`, not `new URL(...).pathname`: on Windows the latter
51
+ * yields `/C:/Users/...`, which every path operation after it treats as
52
+ * a root-relative path that does not exist. The CLI is the first thing
53
+ * a new user runs, so it is the worst place to be silently
54
+ * platform-specific.
55
+ */
56
+ const TEMPLATES_DIR = path.resolve(
57
+ path.dirname(fileURLToPath(import.meta.url)),
58
+ "..",
59
+ "templates"
60
+ );
61
+
62
+ /**
63
+ * Recorded in the manifest so an upgrade knows what wrote a file, and
64
+ * emitted as the dependency range of a scaffolded app. Read from this
65
+ * package's own manifest so a release cannot ship with a stale literal
66
+ * — `../package.json` resolves from src/ and from dist/ alike.
67
+ */
68
+ const FRAMEWORK_VERSION: string = createRequire(import.meta.url)(
69
+ "../package.json"
70
+ ).version;
71
+
72
+ function usage(): string {
73
+ return [
74
+ "intelligo <command>",
75
+ "",
76
+ " create [dir] Scaffold an app, then install the registry pages you pick",
77
+ " (--items a,b | --all, --yes, --no-install)",
78
+ " doctor Report configuration and migration-chain problems",
79
+ " migrate Apply the framework's migration chain to DATABASE_URL",
80
+ " migrate --check Compare the framework's migrations to a database",
81
+ " (--json: one object whose `state` is up_to_date | pending |",
82
+ " fresh | ahead | unmanaged | legacy)",
83
+ " add <feature> Generate consumer-owned source (--force to overwrite)",
84
+ " upgrade --check Show what a template upgrade would change",
85
+ "",
86
+ ].join("\n");
87
+ }
88
+
89
+ async function runMigrate(
90
+ mode: "check" | "apply",
91
+ json = false
92
+ ): Promise<number> {
93
+ const url = process.env.DATABASE_URL;
94
+ if (!url) {
95
+ console.error(
96
+ `DATABASE_URL is required for \`migrate${mode === "check" ? " --check" : ""}\`.`
97
+ );
98
+ return 1;
99
+ }
100
+
101
+ const migrationsDir = resolveMigrationsDir(process.cwd());
102
+ if (!migrationsDir) {
103
+ console.error(
104
+ `No migrations directory (looked in ${MIGRATION_LOCATIONS.join(", ")}) — run from the workspace root, with @intelligo-dev/core installed.`
105
+ );
106
+ return 1;
107
+ }
108
+
109
+ // Imported lazily so `doctor` — the command you reach for when the
110
+ // app will not start — never needs a database driver to load.
111
+ const { Client } = await import("pg");
112
+ const client = new Client({ connectionString: url });
113
+ await client.connect();
114
+
115
+ try {
116
+ if (mode === "check") {
117
+ const result = await migrateCheck(
118
+ migrationsDir,
119
+ async (sql) => (await client.query<{ hash: string }>(sql)).rows
120
+ );
121
+ const probe = await client.query<{ rel: string | null }>(
122
+ SCHEMA_PROBE_SQL
123
+ );
124
+ const schemaExists = probe.rows[0]?.rel != null;
125
+ console.log(
126
+ json
127
+ ? formatMigrateCheckJson(result, schemaExists)
128
+ : formatMigrateCheck(result, schemaExists)
129
+ );
130
+ return migrateCheckExitCode(result);
131
+ }
132
+
133
+ // Applied here rather than by drizzle's migrator: the pending set is
134
+ // chosen by content hash — what `migrate --check` compares — and
135
+ // recorded in drizzle's own table, in one transaction, so a failure
136
+ // part-way leaves neither statements nor records behind.
137
+ const result = await applyMigrations({
138
+ migrationsDir,
139
+ query: async (sql) => (await client.query(sql)).rows,
140
+ run: async (pending) => {
141
+ await client.query("BEGIN");
142
+ try {
143
+ for (const ddl of MIGRATIONS_TABLE_SQL) await client.query(ddl);
144
+ for (const migration of pending) {
145
+ for (const statement of migration.statements) {
146
+ await client.query(statement);
147
+ }
148
+ await client.query(
149
+ `INSERT INTO "drizzle"."__drizzle_migrations" ("hash", "created_at") VALUES ($1, $2)`,
150
+ [migration.hash, migration.createdAt]
151
+ );
152
+ }
153
+ await client.query("COMMIT");
154
+ } catch (error) {
155
+ await client.query("ROLLBACK");
156
+ throw error;
157
+ }
158
+ },
159
+ });
160
+ console.log(formatApplyResult(result));
161
+ return applyExitCode(result);
162
+ } finally {
163
+ await client.end();
164
+ }
165
+ }
166
+
167
+ async function main(): Promise<number> {
168
+ const [, , command = "help", ...rest] = process.argv;
169
+
170
+ // The commands that read the app's configuration see what the app
171
+ // itself would: its .env.local and .env, under anything the shell set.
172
+ if (command === "doctor" || command === "migrate" || command === "upgrade") {
173
+ loadAppEnv(process.cwd());
174
+ }
175
+
176
+ switch (command) {
177
+ case "doctor": {
178
+ const results = runChecks();
179
+ console.log(formatResults(results));
180
+ return exitCodeFor(results);
181
+ }
182
+ case "migrate": {
183
+ // Applying is the default, so a mistyped flag (`--dry-run`,
184
+ // `--chek`) must not fall through to it.
185
+ const unknown = rest.filter(
186
+ (arg) => arg !== "--check" && arg !== "--json"
187
+ );
188
+ if (unknown.length > 0) {
189
+ console.error(
190
+ `intelligo migrate: unknown argument ${unknown.join(" ")}. ` +
191
+ "Use `intelligo migrate` to apply, `--check` to only report, " +
192
+ "and `--json` with `--check` for a machine-readable answer."
193
+ );
194
+ return 2;
195
+ }
196
+ return runMigrate(
197
+ rest.includes("--check") ? "check" : "apply",
198
+ rest.includes("--json")
199
+ );
200
+ }
201
+ case "create": {
202
+ // Imported lazily so the prompts library loads only for the one
203
+ // command that converses.
204
+ const { parseCreateFlags, runCreate } =
205
+ await import("./commands/create-flow.js");
206
+ return runCreate(parseCreateFlags(rest), {
207
+ templatesDir: TEMPLATES_DIR,
208
+ frameworkVersion: FRAMEWORK_VERSION,
209
+ interactive: Boolean(process.stdin.isTTY && process.stdout.isTTY),
210
+ });
211
+ }
212
+ case "add": {
213
+ const feature = rest.find((a) => !a.startsWith("--"));
214
+ if (!feature) {
215
+ const catalogue = readCatalogue(TEMPLATES_DIR);
216
+ console.error("Usage: intelligo add <feature>\n");
217
+ for (const [name, spec] of Object.entries(catalogue)) {
218
+ console.error(` ${name.padEnd(16)} ${spec.description}`);
219
+ }
220
+ return 1;
221
+ }
222
+ const result = addFeature(feature, {
223
+ appRoot: process.cwd(),
224
+ templatesDir: TEMPLATES_DIR,
225
+ frameworkVersion: FRAMEWORK_VERSION,
226
+ force: rest.includes("--force"),
227
+ });
228
+ console.log(formatAddResult(result));
229
+ return addExitCode(result);
230
+ }
231
+ case "upgrade": {
232
+ if (!rest.includes("--check")) {
233
+ console.error("Only `upgrade --check` is implemented.");
234
+ console.error(
235
+ "Applying an upgrade means re-running `intelligo add` for the " +
236
+ "features it reports as outdated — deliberately your call, " +
237
+ "since the files are yours."
238
+ );
239
+ return 1;
240
+ }
241
+ const report = upgradeCheck({
242
+ appRoot: process.cwd(),
243
+ templatesDir: TEMPLATES_DIR,
244
+ });
245
+ console.log(formatUpgradeReport(report));
246
+ return upgradeCheckExitCode(report);
247
+ }
248
+ case "help":
249
+ console.log(usage());
250
+ return 0;
251
+ default:
252
+ console.error(`Unknown command: ${command}\n`);
253
+ console.error(usage());
254
+ return 1;
255
+ }
256
+ }
257
+
258
+ main().then(
259
+ (code) => process.exit(code),
260
+ (error) => {
261
+ console.error(error instanceof Error ? error.message : String(error));
262
+ process.exit(1);
263
+ }
264
+ );