@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
@@ -1,15 +1,14 @@
1
1
  /**
2
2
  * `intelligo upgrade --check`
3
3
  *
4
- * Reports what a template upgrade would do, and does nothing. The
5
- * promise in ADR-0002 is that dependency upgrades never overwrite
6
- * consumer source, so the interesting output is not "these files
7
- * changed upstream" but "these changed upstream AND you have edited
4
+ * Reports what a template upgrade would do, and does nothing. Upgrades
5
+ * never overwrite consumer source, so the interesting output is not
6
+ * "these templates changed" but "these changed AND you have edited
8
7
  * them" — the set where the consumer has to make a decision.
9
8
  */
10
9
  import { existsSync, readFileSync } from "node:fs";
11
10
  import path from "node:path";
12
- import { readCatalogue } from "./add.js";
11
+ import { readCatalogue, substitute } from "./add.js";
13
12
  import { hashContents, readManifest } from "../manifest.js";
14
13
  export function upgradeCheck(options) {
15
14
  const manifest = readManifest(options.appRoot);
@@ -28,6 +27,12 @@ export function upgradeCheck(options) {
28
27
  if (spec)
29
28
  report.templateVersion[feature] = spec.templateVersion;
30
29
  const targetToTemplate = new Map((spec?.files ?? []).map((f) => [f.target, f.template]));
30
+ for (const target of newFiles(spec, [
31
+ ...entry.files,
32
+ ...(entry.handedOver ?? []).map((handed) => ({ path: handed })),
33
+ ])) {
34
+ report.items.push({ feature, path: target, state: "new" });
35
+ }
31
36
  for (const file of entry.files) {
32
37
  const abs = path.join(options.appRoot, file.path);
33
38
  if (!existsSync(abs)) {
@@ -36,10 +41,13 @@ export function upgradeCheck(options) {
36
41
  }
37
42
  const localHash = hashContents(readFileSync(abs, "utf8"));
38
43
  const customized = localHash !== file.hash;
44
+ // Compare against the template as it would be written for THIS
45
+ // app: the recorded hash is of substituted content, so the raw
46
+ // template never matches a file carrying a placeholder.
39
47
  const templateRel = targetToTemplate.get(file.path);
40
48
  let templateChanged = false;
41
49
  if (templateRel) {
42
- const templateHash = hashContents(readFileSync(path.join(options.templatesDir, templateRel), "utf8"));
50
+ const templateHash = hashContents(substitute(readFileSync(path.join(options.templatesDir, templateRel), "utf8"), entry.variables));
43
51
  templateChanged = templateHash !== file.hash;
44
52
  }
45
53
  report.items.push({
@@ -57,6 +65,13 @@ export function upgradeCheck(options) {
57
65
  }
58
66
  return report;
59
67
  }
68
+ /** The feature's files the manifest has no record of: added to the template since. */
69
+ function newFiles(spec, recorded) {
70
+ const known = new Set(recorded.map((file) => file.path));
71
+ return (spec?.files ?? [])
72
+ .map((file) => file.target)
73
+ .filter((target) => !known.has(target));
74
+ }
60
75
  export function formatUpgradeReport(r) {
61
76
  if (r.items.length === 0) {
62
77
  return "No generated files recorded — nothing to upgrade.";
@@ -67,6 +82,7 @@ export function formatUpgradeReport(r) {
67
82
  conflict: "! template changed AND you edited it — review the diff",
68
83
  customized: "= yours (template unchanged)",
69
84
  deleted: "✗ removed by you",
85
+ new: "+ new in the template — `intelligo add` writes it",
70
86
  };
71
87
  const lines = [];
72
88
  for (const [feature, installed] of Object.entries(r.installedVersion)) {
@@ -1 +1 @@
1
- {"version":3,"file":"upgrade-check.js","sourceRoot":"","sources":["../../src/commands/upgrade-check.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EA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kBAAkB;QAC3B,GAAG,EAAE,mDAAmD;KACzD,CAAC;IAEF,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACtE,MAAM,MAAM,GAAG,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QAC1C,KAAK,CAAC,IAAI,CACR,MAAM,IAAI,MAAM,KAAK,SAAS;YAC5B,CAAC,CAAC,GAAG,OAAO,KAAK,SAAS,MAAM,MAAM,EAAE;YACxC,CAAC,CAAC,GAAG,OAAO,KAAK,SAAS,EAAE,CAC/B,CAAC;QACF,KAAK,MAAM,IAAI,IAAI,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC,EAAE,CAAC;YAChE,KAAK,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,CAAgB;IACnD,OAAO,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7D,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The env files a Next.js app reads, in the order it reads them: an
3
+ * earlier file wins, and a variable already set in the shell wins over
4
+ * every file.
5
+ *
6
+ * `migrate` and `doctor` run outside Next, so without this a fresh app
7
+ * whose `DATABASE_URL` lives in `.env.local` — exactly what the
8
+ * quickstart says to do — would fail with "DATABASE_URL is required".
9
+ */
10
+ export declare const ENV_FILES: readonly [".env.local", ".env"];
11
+ export declare function loadAppEnv(root: string, env?: NodeJS.ProcessEnv): string[];
12
+ //# sourceMappingURL=env-files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env-files.d.ts","sourceRoot":"","sources":["../src/env-files.ts"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AACH,eAAO,MAAM,SAAS,iCAAkC,CAAC;AAEzD,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,MAAM,EAAE,CAYV"}
@@ -0,0 +1,29 @@
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import path from "node:path";
3
+ import { parseEnv } from "node:util";
4
+ /**
5
+ * The env files a Next.js app reads, in the order it reads them: an
6
+ * earlier file wins, and a variable already set in the shell wins over
7
+ * every file.
8
+ *
9
+ * `migrate` and `doctor` run outside Next, so without this a fresh app
10
+ * whose `DATABASE_URL` lives in `.env.local` — exactly what the
11
+ * quickstart says to do — would fail with "DATABASE_URL is required".
12
+ */
13
+ export const ENV_FILES = [".env.local", ".env"];
14
+ export function loadAppEnv(root, env = process.env) {
15
+ const loaded = [];
16
+ for (const name of ENV_FILES) {
17
+ const file = path.join(root, name);
18
+ if (!existsSync(file))
19
+ continue;
20
+ const values = parseEnv(readFileSync(file, "utf8"));
21
+ for (const [key, value] of Object.entries(values)) {
22
+ if (env[key] === undefined)
23
+ env[key] = value;
24
+ }
25
+ loaded.push(name);
26
+ }
27
+ return loaded;
28
+ }
29
+ //# sourceMappingURL=env-files.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env-files.js","sourceRoot":"","sources":["../src/env-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,YAAY,EAAE,MAAM,CAAU,CAAC;AAEzD,MAAM,UAAU,UAAU,CACxB,IAAY,EACZ,MAAyB,OAAO,CAAC,GAAG;IAEpC,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE,CAAC;QAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACnC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YAAE,SAAS;QAChC,MAAM,MAAM,GAAG,QAAQ,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;QACpD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAClD,IAAI,GAAG,CAAC,GAAG,CAAC,KAAK,SAAS;gBAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QAC/C,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -7,4 +7,13 @@
7
7
  export { runChecks, formatResults, exitCodeFor, type CheckResult, type DoctorOptions, } from "./commands/doctor.js";
8
8
  export { migrateCheck, hashMigration, formatMigrateCheck, migrateCheckExitCode, type MigrateCheckResult, } from "./commands/migrate-check.js";
9
9
  export { readMigrationChain, inspectMigrationChain, type MigrationChain, type ChainProblem, } from "./migrations.js";
10
+ /**
11
+ * Where the framework's chain lives. Exported because a consumer's own
12
+ * operational scripts — baselining a push-provisioned database, a
13
+ * one-off audit — otherwise hardcode
14
+ * `node_modules/@intelligo-dev/core/src/db/migrations`, which is right
15
+ * in an application and wrong in the framework repository, and which
16
+ * silently stops being either if the package layout ever changes.
17
+ */
18
+ export { resolveMigrationsDir, MIGRATION_LOCATIONS } from "./migrations-dir.js";
10
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,SAAS,EACT,aAAa,EACb,WAAW,EACX,KAAK,WAAW,EAChB,KAAK,aAAa,GACnB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EACpB,KAAK,kBAAkB,GACxB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,KAAK,cAAc,EACnB,KAAK,YAAY,GAClB,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,SAAS,EACT,aAAa,EACb,WAAW,EACX,KAAK,WAAW,EAChB,KAAK,aAAa,GACnB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EACpB,KAAK,kBAAkB,GACxB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,KAAK,cAAc,EACnB,KAAK,YAAY,GAClB,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;GAOG;AACH,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC"}
package/dist/index.js CHANGED
@@ -7,4 +7,13 @@
7
7
  export { runChecks, formatResults, exitCodeFor, } from "./commands/doctor.js";
8
8
  export { migrateCheck, hashMigration, formatMigrateCheck, migrateCheckExitCode, } from "./commands/migrate-check.js";
9
9
  export { readMigrationChain, inspectMigrationChain, } from "./migrations.js";
10
+ /**
11
+ * Where the framework's chain lives. Exported because a consumer's own
12
+ * operational scripts — baselining a push-provisioned database, a
13
+ * one-off audit — otherwise hardcode
14
+ * `node_modules/@intelligo-dev/core/src/db/migrations`, which is right
15
+ * in an application and wrong in the framework repository, and which
16
+ * silently stops being either if the package layout ever changes.
17
+ */
18
+ export { resolveMigrationsDir, MIGRATION_LOCATIONS } from "./migrations-dir.js";
10
19
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,SAAS,EACT,aAAa,EACb,WAAW,GAGZ,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,oBAAoB,GAErB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,kBAAkB,EAClB,qBAAqB,GAGtB,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,SAAS,EACT,aAAa,EACb,WAAW,GAGZ,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,oBAAoB,GAErB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,kBAAkB,EAClB,qBAAqB,GAGtB,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;GAOG;AACH,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -2,7 +2,7 @@
2
2
  * Generated-source manifest.
3
3
  *
4
4
  * Intelligo generates starting source into the consumer's repository
5
- * and then stops owning it (ADR-0002). That promise needs a mechanism,
5
+ * and then stops owning it. That promise needs a mechanism,
6
6
  * because "never overwrite a customized file" requires knowing which
7
7
  * files were generated, from which template version, and whether the
8
8
  * consumer has since edited them.
@@ -25,34 +25,55 @@ export type GeneratedFile = {
25
25
  export type FeatureEntry = {
26
26
  templateVersion: string;
27
27
  files: GeneratedFile[];
28
+ /**
29
+ * Placeholder substitutions the files were generated with
30
+ * (`__APP_NAME__` → "acme"). Recorded so an upgrade check can hash the
31
+ * template *as it would be written for this app*; the raw template
32
+ * would make every substituted file look permanently outdated.
33
+ */
34
+ variables?: Record<string, string>;
35
+ /**
36
+ * Files this feature wrote that a registry install has since replaced
37
+ * (the scaffold's globals.css once the design-system base lands):
38
+ * `intelligo sync` owns them now, so `upgrade --check` neither
39
+ * compares them nor offers them as new, and `add` does not write them
40
+ * back.
41
+ */
42
+ handedOver?: string[];
43
+ };
44
+ /**
45
+ * Registry items `intelligo sync` installed: which items the app keeps
46
+ * in sync, the framework version they came from, and — per installed
47
+ * file that is not a seam or a message file — the hash of the file as
48
+ * written (after shadcn's normalisation, see `asInstalled`). A file
49
+ * whose hash still matches was not edited since, so a newer registry
50
+ * may replace it; one that differs was edited by hand.
51
+ */
52
+ export type RegistryEntry = {
53
+ version: string;
54
+ items: string[];
55
+ files: Record<string, string>;
28
56
  };
29
57
  export type Manifest = {
30
58
  schemaVersion: 1;
31
59
  frameworkVersion: string;
32
60
  features: Record<string, FeatureEntry>;
61
+ registry?: RegistryEntry;
33
62
  };
34
63
  export declare function hashContents(contents: string): string;
35
64
  export declare function emptyManifest(frameworkVersion: string): Manifest;
36
65
  export declare function readManifest(appRoot: string): Manifest | null;
37
66
  export declare function writeManifest(appRoot: string, manifest: Manifest): void;
38
- /**
39
- * What happened to a generated file since it was written.
40
- *
41
- * `customized` is the state the whole mechanism exists to detect: the
42
- * consumer owns that file now, and an upgrade must not touch it.
43
- */
44
- export type FileState = "unchanged" | "customized" | "deleted";
45
- export type FileStatus = {
46
- path: string;
47
- state: FileState;
48
- };
49
- export declare function inspectFile(appRoot: string, file: GeneratedFile): FileStatus;
50
- export declare function inspectFeature(appRoot: string, entry: FeatureEntry): FileStatus[];
51
67
  /**
52
68
  * Record a feature's generated files, replacing any previous entry for
53
69
  * the same feature — re-generating is how a consumer accepts a new
54
70
  * template version, and the recorded hashes must then describe what is
55
71
  * actually on disk.
56
72
  */
57
- export declare function recordFeature(manifest: Manifest, feature: string, templateVersion: string, files: GeneratedFile[]): Manifest;
73
+ export declare function recordFeature(manifest: Manifest, feature: string, templateVersion: string, files: GeneratedFile[], variables?: Record<string, string>): Manifest;
74
+ /**
75
+ * Move `paths` out of a feature's generated files into its `handedOver`
76
+ * list. A no-op for a feature the manifest does not record.
77
+ */
78
+ export declare function handOver(manifest: Manifest, feature: string, paths: readonly string[]): Manifest;
58
79
  //# sourceMappingURL=manifest.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAMH,eAAO,MAAM,aAAa,4BAA4B,CAAC;AAEvD,MAAM,MAAM,aAAa,GAAG;IAC1B,sDAAsD;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,aAAa,EAAE,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,aAAa,EAAE,CAAC,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;CACxC,CAAC;AAEF,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,wBAAgB,aAAa,CAAC,gBAAgB,EAAE,MAAM,GAAG,QAAQ,CAEhE;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAI7D;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI,C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,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,aAAa,EAAE,CAAC,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACvC,QAAQ,CAAC,EAAE,aAAa,CAAC;CAC1B,CAAC;AAEF,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,wBAAgB,aAAa,CAAC,gBAAgB,EAAE,MAAM,GAAG,QAAQ,CAEhE;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAI7D;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAKvE;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,MAAM,EACf,eAAe,EAAE,MAAM,EACvB,KAAK,EAAE,aAAa,EAAE,EACtB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACjC,QAAQ,CAcV;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CACtB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,SAAS,MAAM,EAAE,GACvB,QAAQ,CAiBV"}
package/dist/manifest.js CHANGED
@@ -2,7 +2,7 @@
2
2
  * Generated-source manifest.
3
3
  *
4
4
  * Intelligo generates starting source into the consumer's repository
5
- * and then stops owning it (ADR-0002). That promise needs a mechanism,
5
+ * and then stops owning it. That promise needs a mechanism,
6
6
  * because "never overwrite a customized file" requires knowing which
7
7
  * files were generated, from which template version, and whether the
8
8
  * consumer has since edited them.
@@ -34,31 +34,47 @@ export function readManifest(appRoot) {
34
34
  export function writeManifest(appRoot, manifest) {
35
35
  writeFileSync(path.join(appRoot, MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}\n`);
36
36
  }
37
- export function inspectFile(appRoot, file) {
38
- const abs = path.join(appRoot, file.path);
39
- if (!existsSync(abs))
40
- return { path: file.path, state: "deleted" };
41
- const current = hashContents(readFileSync(abs, "utf8"));
42
- return {
43
- path: file.path,
44
- state: current === file.hash ? "unchanged" : "customized",
45
- };
46
- }
47
- export function inspectFeature(appRoot, entry) {
48
- return entry.files.map((f) => inspectFile(appRoot, f));
49
- }
50
37
  /**
51
38
  * Record a feature's generated files, replacing any previous entry for
52
39
  * the same feature — re-generating is how a consumer accepts a new
53
40
  * template version, and the recorded hashes must then describe what is
54
41
  * actually on disk.
55
42
  */
56
- export function recordFeature(manifest, feature, templateVersion, files) {
43
+ export function recordFeature(manifest, feature, templateVersion, files, variables) {
44
+ const handedOver = manifest.features[feature]?.handedOver;
45
+ return {
46
+ ...manifest,
47
+ features: {
48
+ ...manifest.features,
49
+ [feature]: {
50
+ templateVersion,
51
+ files,
52
+ ...(variables ? { variables } : {}),
53
+ ...(handedOver?.length ? { handedOver } : {}),
54
+ },
55
+ },
56
+ };
57
+ }
58
+ /**
59
+ * Move `paths` out of a feature's generated files into its `handedOver`
60
+ * list. A no-op for a feature the manifest does not record.
61
+ */
62
+ export function handOver(manifest, feature, paths) {
63
+ const entry = manifest.features[feature];
64
+ if (!entry || paths.length === 0)
65
+ return manifest;
66
+ const moved = new Set(paths);
57
67
  return {
58
68
  ...manifest,
59
69
  features: {
60
70
  ...manifest.features,
61
- [feature]: { templateVersion, files },
71
+ [feature]: {
72
+ ...entry,
73
+ files: entry.files.filter((f) => !moved.has(f.path)),
74
+ handedOver: [
75
+ ...new Set([...(entry.handedOver ?? []), ...paths]),
76
+ ].sort(),
77
+ },
62
78
  },
63
79
  };
64
80
  }
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.js","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,C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CAAC,OAAO,CAAC,CAAC;IACzC,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,QAAQ,CAAC;IAClD,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;IAC7B,OAAO;QACL,GAAG,QAAQ;QACX,QAAQ,EAAE;YACR,GAAG,QAAQ,CAAC,QAAQ;YACpB,CAAC,OAAO,CAAC,EAAE;gBACT,GAAG,KAAK;gBACR,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;gBACpD,UAAU,EAAE;oBACV,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,IAAI,EAAE,CAAC,EAAE,GAAG,KAAK,CAAC,CAAC;iBACpD,CAAC,IAAI,EAAE;aACT;SACF;KACF,CAAC;AACJ,CAAC"}
@@ -3,12 +3,9 @@
3
3
  *
4
4
  * 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.d.ts","sourceRoot":"","sources":["../src/migrations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH,MAAM,MAAM,YAAY,GAAG;IACzB,GA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C;CACnB,CAAC;AAMF,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CA2B9D;AAED,MAAM,MAAM,YAAY,GAAG;IAAE,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAExE,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,cAAc,GAAG,YAAY,EAAE,CA4D3E"}
@@ -3,12 +3,9 @@
3
3
  *
4
4
  * 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,CA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AAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACvC,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,GAAG,CAAC,CAAE,CAAC;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,63 @@
1
+ /**
2
+ * What a TypeScript module exports, read from its text — enough for
3
+ * `doctor` to confirm an app provides the names an installed item
4
+ * imports, without compiling or running the app.
5
+ *
6
+ * It understands declarations (`export const|function|class|type|
7
+ * interface|enum …`), export lists with aliases (`export { a as b }`),
8
+ * re-exports (`export { x } from "…"`, `export * from "…"`) and the
9
+ * imports a bare export list re-exports. Modules are resolved the way
10
+ * the app would: relative paths, the `@/` alias, and packages through
11
+ * node resolution from the app's root (a workspace package included).
12
+ */
13
+ /**
14
+ * Block and line comments removed, so a check cannot be satisfied — or
15
+ * defeated — by prose.
16
+ */
17
+ export declare function stripComments(text: string): string;
18
+ export declare function escapeRegExp(text: string): string;
19
+ export type ModuleShape = {
20
+ /** Names exported by this module itself, or re-exported by name. */
21
+ names: Set<string>;
22
+ /** Exported name → the module it is re-exported from, when it is. */
23
+ reexports: Map<string, string>;
24
+ /** `export * from "…"` specifiers. */
25
+ stars: string[];
26
+ /** Local name → the module it was imported from. */
27
+ imports: Map<string, string>;
28
+ };
29
+ /** The shape of a module's text; comments are stripped first. */
30
+ export declare function moduleShape(source: string): ModuleShape;
31
+ /**
32
+ * The file a module specifier leads to from `fromFile`, or null when it
33
+ * cannot be found: relative, the `@/` alias, then node resolution from
34
+ * the app's root.
35
+ */
36
+ export declare function resolveModule(specifier: string, fromFile: string, appRoot: string): string | null;
37
+ export type ExportCheck = {
38
+ /** Names the module provably does not export. */
39
+ missing: string[];
40
+ /**
41
+ * `export * from` specifiers that could not be read: the names not
42
+ * found elsewhere are assumed to come from them.
43
+ */
44
+ unresolved: string[];
45
+ };
46
+ /**
47
+ * Which of `names` the module at `file` does not export, following
48
+ * `export * from` into the modules it can resolve.
49
+ */
50
+ export declare function checkExports(file: string, names: readonly string[], appRoot: string, seen?: Set<string>): ExportCheck;
51
+ /**
52
+ * The text of a module and of every module it re-exports from —
53
+ * `export … from`, `export * from`, and imports a bare export list
54
+ * passes on — comments stripped. What a `lib/plans.ts` that re-exports
55
+ * a workspace package's catalogue actually defines.
56
+ */
57
+ export declare function reexportedSource(file: string, appRoot: string, depth?: number): {
58
+ text: string;
59
+ unresolved: string[];
60
+ };
61
+ /** An object key `key:` or `"key":`, not a longer identifier ending in it. */
62
+ export declare function hasObjectKey(text: string, key: string): boolean;
63
+ //# sourceMappingURL=module-exports.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module-exports.d.ts","sourceRoot":"","sources":["../src/module-exports.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIlD;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,M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