@intelligo-dev/cli 1.0.0-beta.13 → 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.
- package/README.md +41 -2
- package/dist/bin.js +37 -0
- package/dist/bin.js.map +1 -1
- package/dist/commands/add.d.ts +4 -0
- package/dist/commands/add.d.ts.map +1 -1
- package/dist/commands/add.js +9 -0
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/create-flow.d.ts +4 -1
- package/dist/commands/create-flow.d.ts.map +1 -1
- package/dist/commands/create-flow.js +63 -31
- package/dist/commands/create-flow.js.map +1 -1
- package/dist/commands/create.d.ts +8 -4
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +15 -7
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +21 -19
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/migrate-check.d.ts +20 -1
- package/dist/commands/migrate-check.d.ts.map +1 -1
- package/dist/commands/migrate-check.js +35 -6
- package/dist/commands/migrate-check.js.map +1 -1
- package/dist/commands/migrate.d.ts.map +1 -1
- package/dist/commands/migrate.js +2 -8
- package/dist/commands/migrate.js.map +1 -1
- package/dist/commands/sync-messages.d.ts +37 -0
- package/dist/commands/sync-messages.d.ts.map +1 -0
- package/dist/commands/sync-messages.js +88 -0
- package/dist/commands/sync-messages.js.map +1 -0
- package/dist/commands/sync-scaffold.d.ts +36 -0
- package/dist/commands/sync-scaffold.d.ts.map +1 -0
- package/dist/commands/sync-scaffold.js +53 -0
- package/dist/commands/sync-scaffold.js.map +1 -0
- package/dist/commands/sync.d.ts +103 -0
- package/dist/commands/sync.d.ts.map +1 -0
- package/dist/commands/sync.js +361 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/commands/upgrade-check.d.ts.map +1 -1
- package/dist/commands/upgrade-check.js +4 -1
- package/dist/commands/upgrade-check.js.map +1 -1
- package/dist/manifest.d.ts +27 -0
- package/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.js +30 -3
- package/dist/manifest.js.map +1 -1
- package/dist/module-exports.d.ts +63 -0
- package/dist/module-exports.d.ts.map +1 -0
- package/dist/module-exports.js +231 -0
- package/dist/module-exports.js.map +1 -0
- package/dist/registry-bundle.d.ts +43 -0
- package/dist/registry-bundle.d.ts.map +1 -0
- package/dist/registry-bundle.js +74 -0
- package/dist/registry-bundle.js.map +1 -0
- package/dist/registry-items.d.ts +41 -13
- package/dist/registry-items.d.ts.map +1 -1
- package/dist/registry-items.js +117 -33
- package/dist/registry-items.js.map +1 -1
- package/package.json +1 -1
- package/src/bin.ts +52 -0
- package/src/commands/add.ts +11 -0
- package/src/commands/create-flow.ts +82 -26
- package/src/commands/create.ts +17 -7
- package/src/commands/doctor.ts +27 -27
- package/src/commands/migrate-check.ts +51 -10
- package/src/commands/migrate.ts +2 -8
- package/src/commands/sync-messages.ts +114 -0
- package/src/commands/sync-scaffold.ts +83 -0
- package/src/commands/sync.ts +534 -0
- package/src/commands/upgrade-check.ts +4 -1
- package/src/manifest.ts +57 -3
- package/src/module-exports.ts +266 -0
- package/src/registry-bundle.ts +103 -0
- package/src/registry-items.ts +141 -36
- package/templates/app-scaffold/intelligo.ts.tpl +6 -47
- package/templates/manifest.json +19 -0
- package/templates/registry/ai-agent-activity.json +23 -0
- package/templates/registry/ai-agent-progress.json +21 -0
- package/templates/registry/ai-approval-card.json +27 -0
- package/templates/registry/ai-artifact.json +22 -0
- package/templates/registry/ai-branch.json +21 -0
- package/templates/registry/ai-citations.json +24 -0
- package/templates/registry/ai-code-block.json +23 -0
- package/templates/registry/ai-composer-menu.json +19 -0
- package/templates/registry/ai-file-diff.json +25 -0
- package/templates/registry/ai-image-generation.json +23 -0
- package/templates/registry/ai-markdown.json +23 -0
- package/templates/registry/ai-message-bubble.json +23 -0
- package/templates/registry/ai-message-scroller.json +22 -0
- package/templates/registry/ai-message.json +21 -0
- package/templates/registry/ai-motion.json +19 -0
- package/templates/registry/ai-prompt-input.json +28 -0
- package/templates/registry/ai-reasoning-text.json +22 -0
- package/templates/registry/ai-reasoning.json +22 -0
- package/templates/registry/ai-shimmer-text.json +19 -0
- package/templates/registry/ai-sidebar.json +25 -0
- package/templates/registry/ai-speech-input.json +21 -0
- package/templates/registry/ai-streaming-response.json +24 -0
- package/templates/registry/ai-suggestion.json +19 -0
- package/templates/registry/ai-todo-list.json +22 -0
- package/templates/registry/ai-tool-approval.json +26 -0
- package/templates/registry/ai-tool-result.json +25 -0
- package/templates/registry/alert-dialog.json +23 -0
- package/templates/registry/animated-list.json +21 -0
- package/templates/registry/app-shell.json +93 -0
- package/templates/registry/artifacts.json +82 -0
- package/templates/registry/attachment.json +22 -0
- package/templates/registry/auth-email-verification.json +39 -0
- package/templates/registry/auth-login.json +72 -0
- package/templates/registry/auth-password-reset.json +53 -0
- package/templates/registry/auth-signup.json +41 -0
- package/templates/registry/billing-settings.json +60 -0
- package/templates/registry/button.json +22 -0
- package/templates/registry/chat-eve.json +19 -0
- package/templates/registry/chat-panel.json +30 -0
- package/templates/registry/chat-share.json +42 -0
- package/templates/registry/chat-widget.json +34 -0
- package/templates/registry/chat.json +326 -0
- package/templates/registry/checkbox.json +22 -0
- package/templates/registry/checkout.json +40 -0
- package/templates/registry/collapsible.json +19 -0
- package/templates/registry/command.json +23 -0
- package/templates/registry/copy-button.json +21 -0
- package/templates/registry/dashboard.json +69 -0
- package/templates/registry/dialog.json +24 -0
- package/templates/registry/document-viewer.json +22 -0
- package/templates/registry/dropdown-menu.json +23 -0
- package/templates/registry/expandable-tabs.json +22 -0
- package/templates/registry/feature-gating.json +73 -0
- package/templates/registry/file-upload.json +24 -0
- package/templates/registry/hold-action-button.json +22 -0
- package/templates/registry/input-group.json +23 -0
- package/templates/registry/input.json +19 -0
- package/templates/registry/intelligo.json +187 -0
- package/templates/registry/invitation-accept.json +64 -0
- package/templates/registry/language-switcher.json +29 -0
- package/templates/registry/morphing-modal.json +24 -0
- package/templates/registry/notification-stack.json +24 -0
- package/templates/registry/notifications.json +87 -0
- package/templates/registry/onboarding.json +83 -0
- package/templates/registry/otp-input.json +22 -0
- package/templates/registry/page-header.json +15 -0
- package/templates/registry/payment-poll.json +52 -0
- package/templates/registry/popover-morph.json +22 -0
- package/templates/registry/popover.json +22 -0
- package/templates/registry/pricing.json +111 -0
- package/templates/registry/privacy-settings.json +65 -0
- package/templates/registry/profile-settings.json +68 -0
- package/templates/registry/progress.json +19 -0
- package/templates/registry/radio-group.json +22 -0
- package/templates/registry/registry.json +2945 -0
- package/templates/registry/route-error.json +65 -0
- package/templates/registry/select-morph.json +23 -0
- package/templates/registry/select.json +23 -0
- package/templates/registry/settings-shell.json +47 -0
- package/templates/registry/sheet.json +24 -0
- package/templates/registry/sidebar.json +28 -0
- package/templates/registry/smoke.json +34 -0
- package/templates/registry/spinner.json +16 -0
- package/templates/registry/stat-card.json +18 -0
- package/templates/registry/status-badge.json +18 -0
- package/templates/registry/switch.json +20 -0
- package/templates/registry/tabs.json +23 -0
- package/templates/registry/team-settings.json +97 -0
- package/templates/registry/textarea.json +16 -0
- package/templates/registry/tooltip.json +22 -0
- package/templates/registry/trial-banner.json +43 -0
- package/templates/registry/usage.json +84 -0
- package/templates/registry/workspace-settings.json +71 -0
- package/templates/registry-items.json +1 -1
- package/templates/registry-requires.json +26 -2
- package/templates/vitest/server-only.ts.tpl +7 -0
- package/templates/vitest/vitest.config.ts.tpl +37 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry-items.js","sourceRoot":"","sources":["../src/registry-items.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"registry-items.js","sourceRoot":"","sources":["../src/registry-items.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,IAAI,MAAM,WAAW,CAAC;AAU7B,8EAA8E;AAC9E,MAAM,UAAU,qBAAq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IAC3B,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC;IAChD,MAAM,MAAM,GAAG,CAAC,IAAI,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC;IAC1D,OAAO;QACL,OAAO,EAAE,cAAc,CAAC,OAAO,CAAC,OAAO,CAAC;YACtC,CAAC,CAAC,IAAI;YACN,CAAC,CAAC;gBACE,OAAO,EAAE,cAAc;gBACvB,IAAI,EAAE,CAAC,SAAS,CAAC;gBACjB,GAAG,EAAE,OAAO,CAAC,aAAa,IAAI,OAAO,CAAC,OAAO;aAC9C;QACL,KAAK,EAAE,MAAM;QACb,IAAI,EAAE;YACJ,OAAO,EAAE,OAAQ;YACjB,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,SAAS,CAAC;YAC1D,GAAG,EAAE,OAAO,CAAC,OAAO;SACrB;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
package/src/bin.ts
CHANGED
|
@@ -35,6 +35,15 @@ import {
|
|
|
35
35
|
applyMigrations,
|
|
36
36
|
formatApplyResult,
|
|
37
37
|
} from "./commands/migrate.js";
|
|
38
|
+
import {
|
|
39
|
+
formatSyncReport,
|
|
40
|
+
installedFrameworkVersion,
|
|
41
|
+
selectItems,
|
|
42
|
+
syncApply,
|
|
43
|
+
syncCheck,
|
|
44
|
+
syncCheckExitCode,
|
|
45
|
+
type SyncContext,
|
|
46
|
+
} from "./commands/sync.js";
|
|
38
47
|
import {
|
|
39
48
|
formatUpgradeReport,
|
|
40
49
|
upgradeCheck,
|
|
@@ -42,6 +51,8 @@ import {
|
|
|
42
51
|
} from "./commands/upgrade-check.js";
|
|
43
52
|
|
|
44
53
|
import { loadAppEnv } from "./env-files.js";
|
|
54
|
+
import { resolveRegistryDir } from "./registry-bundle.js";
|
|
55
|
+
import { readRegistryCatalogue } from "./registry-items.js";
|
|
45
56
|
import { MIGRATION_LOCATIONS, resolveMigrationsDir } from "./migrations-dir.js";
|
|
46
57
|
|
|
47
58
|
/**
|
|
@@ -82,6 +93,9 @@ function usage(): string {
|
|
|
82
93
|
" fresh | ahead | unmanaged | legacy)",
|
|
83
94
|
" add <feature> Generate consumer-owned source (--force to overwrite)",
|
|
84
95
|
" upgrade --check Show what a template upgrade would change",
|
|
96
|
+
" sync [items…] Install registry pages from this release's registry,",
|
|
97
|
+
" keeping seams and merging messages (--force replaces",
|
|
98
|
+
" hand-edited files; --check only reports, exit 1 on drift)",
|
|
85
99
|
"",
|
|
86
100
|
].join("\n");
|
|
87
101
|
}
|
|
@@ -245,6 +259,44 @@ async function main(): Promise<number> {
|
|
|
245
259
|
console.log(formatUpgradeReport(report));
|
|
246
260
|
return upgradeCheckExitCode(report);
|
|
247
261
|
}
|
|
262
|
+
case "sync": {
|
|
263
|
+
const registryDir = resolveRegistryDir(TEMPLATES_DIR);
|
|
264
|
+
if (!registryDir) {
|
|
265
|
+
console.error(
|
|
266
|
+
"This CLI has no bundled registry — in the framework repository, run `pnpm registry:build` first."
|
|
267
|
+
);
|
|
268
|
+
return 1;
|
|
269
|
+
}
|
|
270
|
+
const context: SyncContext = {
|
|
271
|
+
appRoot: process.cwd(),
|
|
272
|
+
registryDir,
|
|
273
|
+
requires: readRegistryCatalogue(TEMPLATES_DIR).requires,
|
|
274
|
+
frameworkVersion: FRAMEWORK_VERSION,
|
|
275
|
+
};
|
|
276
|
+
const installed = installedFrameworkVersion(context.appRoot);
|
|
277
|
+
if (installed && installed !== FRAMEWORK_VERSION) {
|
|
278
|
+
console.error(
|
|
279
|
+
`! @intelligo-dev/core is ${installed} but this CLI carries the ${FRAMEWORK_VERSION} registry — ` +
|
|
280
|
+
"run the CLI of the same version (`pnpm exec intelligo`), or pages and packages will disagree."
|
|
281
|
+
);
|
|
282
|
+
}
|
|
283
|
+
const selection = selectItems(
|
|
284
|
+
rest.filter((a) => !a.startsWith("-")),
|
|
285
|
+
context
|
|
286
|
+
);
|
|
287
|
+
if (!selection.ok) {
|
|
288
|
+
console.error(selection.message);
|
|
289
|
+
return 1;
|
|
290
|
+
}
|
|
291
|
+
if (rest.includes("--check")) {
|
|
292
|
+
const report = syncCheck(selection.items, context);
|
|
293
|
+
console.log(formatSyncReport(report));
|
|
294
|
+
return syncCheckExitCode(report);
|
|
295
|
+
}
|
|
296
|
+
return syncApply(selection.items, context, {
|
|
297
|
+
force: rest.includes("--force"),
|
|
298
|
+
});
|
|
299
|
+
}
|
|
248
300
|
case "help":
|
|
249
301
|
console.log(usage());
|
|
250
302
|
return 0;
|
package/src/commands/add.ts
CHANGED
|
@@ -30,6 +30,8 @@ export type TemplateFeature = {
|
|
|
30
30
|
deprecated?: string;
|
|
31
31
|
files: TemplateFile[];
|
|
32
32
|
cron?: TemplateCron;
|
|
33
|
+
/** What the developer still does by hand once the files are written. */
|
|
34
|
+
nextSteps?: string[];
|
|
33
35
|
};
|
|
34
36
|
export type TemplateCatalogue = Record<string, TemplateFeature>;
|
|
35
37
|
|
|
@@ -54,6 +56,8 @@ export type AddResult = {
|
|
|
54
56
|
* app has a vercel.json without it, which is the consumer's to edit.
|
|
55
57
|
*/
|
|
56
58
|
cron?: TemplateCron & { status: "written" | "present" | "manual" };
|
|
59
|
+
/** The catalogue's steps left to the developer, printed after the files. */
|
|
60
|
+
nextSteps?: string[];
|
|
57
61
|
};
|
|
58
62
|
|
|
59
63
|
export type AddOptions = {
|
|
@@ -137,9 +141,13 @@ export function addFeature(feature: string, options: AddOptions): AddResult {
|
|
|
137
141
|
skippedUnknown: [],
|
|
138
142
|
};
|
|
139
143
|
if (spec.deprecated) result.deprecated = spec.deprecated;
|
|
144
|
+
if (spec.nextSteps?.length) result.nextSteps = spec.nextSteps;
|
|
140
145
|
const recorded: GeneratedFile[] = [];
|
|
146
|
+
const handedOver = new Set(previous?.handedOver ?? []);
|
|
141
147
|
|
|
142
148
|
for (const file of spec.files) {
|
|
149
|
+
// A registry item replaced it; `intelligo sync` keeps it now.
|
|
150
|
+
if (handedOver.has(file.target)) continue;
|
|
143
151
|
const source = path.join(options.templatesDir, file.template);
|
|
144
152
|
const target = path.join(options.appRoot, file.target);
|
|
145
153
|
const contents = substitute(
|
|
@@ -212,6 +220,9 @@ export function formatAddResult(r: AddResult): string {
|
|
|
212
220
|
)
|
|
213
221
|
lines.push(" nothing to do");
|
|
214
222
|
if (r.cron) lines.push(...cronNextSteps(r.cron));
|
|
223
|
+
if (r.nextSteps?.length) {
|
|
224
|
+
lines.push("", " Next:", ...r.nextSteps.map((step) => ` - ${step}`));
|
|
225
|
+
}
|
|
215
226
|
return lines.join("\n");
|
|
216
227
|
}
|
|
217
228
|
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The conversation around `createApp`: ask what the flags did not say,
|
|
3
3
|
* scaffold, and install the chosen registry items once the developer
|
|
4
|
-
* has approved the commands that do it.
|
|
4
|
+
* has approved the commands that do it. The items go in through
|
|
5
|
+
* `intelligo sync` — one `shadcn add` per item from the registry this
|
|
6
|
+
* CLI carries, recorded in the manifest — exactly as a later sync
|
|
7
|
+
* would put them back.
|
|
5
8
|
*
|
|
6
9
|
* Nothing runs on the developer's machine without their say-so. In a
|
|
7
10
|
* terminal the commands are shown and confirmed; without one (CI, a
|
|
@@ -21,15 +24,18 @@ import {
|
|
|
21
24
|
formatNextSteps,
|
|
22
25
|
isOccupied,
|
|
23
26
|
} from "./create.js";
|
|
27
|
+
import { syncApply, type SyncContext } from "./sync.js";
|
|
28
|
+
import { resolveRegistryDir } from "../registry-bundle.js";
|
|
24
29
|
import {
|
|
25
30
|
detectPackageManager,
|
|
31
|
+
findWorkspaceRoot,
|
|
26
32
|
formatCommand,
|
|
27
|
-
hasLocalShadcn,
|
|
28
33
|
installPlan,
|
|
29
34
|
readRegistryCatalogue,
|
|
30
35
|
shortDescription,
|
|
31
36
|
withDependencies,
|
|
32
37
|
type Command,
|
|
38
|
+
type InstallPlan,
|
|
33
39
|
} from "../registry-items.js";
|
|
34
40
|
|
|
35
41
|
export type CreateFlags = {
|
|
@@ -97,6 +103,47 @@ function run(c: Command, cwd: string): boolean {
|
|
|
97
103
|
return result.status === 0;
|
|
98
104
|
}
|
|
99
105
|
|
|
106
|
+
/**
|
|
107
|
+
* Run the plan: the dependency install, then the sync. Returns the
|
|
108
|
+
* commands still to run by hand — none when both succeeded.
|
|
109
|
+
*/
|
|
110
|
+
async function installPages(
|
|
111
|
+
plan: InstallPlan,
|
|
112
|
+
options: {
|
|
113
|
+
appRoot: string;
|
|
114
|
+
interactive: boolean;
|
|
115
|
+
show: (c: Command) => string;
|
|
116
|
+
syncContext: SyncContext;
|
|
117
|
+
}
|
|
118
|
+
): Promise<Command[]> {
|
|
119
|
+
const { appRoot, interactive, show } = options;
|
|
120
|
+
const say = (line: string) =>
|
|
121
|
+
interactive ? p.log.step(line) : console.log(line);
|
|
122
|
+
const fail = (message: string) =>
|
|
123
|
+
interactive ? p.log.error(message) : console.error(message);
|
|
124
|
+
if (plan.install) {
|
|
125
|
+
say(`› ${show(plan.install)}`);
|
|
126
|
+
if (!run(plan.install, plan.install.cwd ?? appRoot)) {
|
|
127
|
+
fail(
|
|
128
|
+
`\`${show(plan.install)}\` failed — the scaffold is in place; run the rest by hand.`
|
|
129
|
+
);
|
|
130
|
+
return [plan.install, plan.sync];
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
say(`› ${show(plan.sync)}`);
|
|
134
|
+
const code = await syncApply(plan.items, options.syncContext, {
|
|
135
|
+
force: true,
|
|
136
|
+
log: say,
|
|
137
|
+
});
|
|
138
|
+
if (code !== 0) {
|
|
139
|
+
fail(
|
|
140
|
+
"The pages did not all install — the scaffold is in place; re-run the sync by hand."
|
|
141
|
+
);
|
|
142
|
+
return [plan.sync];
|
|
143
|
+
}
|
|
144
|
+
return [];
|
|
145
|
+
}
|
|
146
|
+
|
|
100
147
|
export async function runCreate(
|
|
101
148
|
flags: CreateFlags,
|
|
102
149
|
context: {
|
|
@@ -178,14 +225,24 @@ export async function runCreate(
|
|
|
178
225
|
}
|
|
179
226
|
|
|
180
227
|
// 4. The pages — only with approval.
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
228
|
+
const workspaceRoot = findWorkspaceRoot(appRoot);
|
|
229
|
+
const plan = installPlan(items, { appRoot, packageManager, workspaceRoot });
|
|
230
|
+
const commands: Command[] = plan
|
|
231
|
+
? [...(plan.install ? [plan.install] : []), plan.sync]
|
|
232
|
+
: [];
|
|
233
|
+
const show = (c: Command) => formatCommand(c, appRoot);
|
|
234
|
+
const registryDir = resolveRegistryDir(context.templatesDir);
|
|
235
|
+
if (plan && flags.install && !registryDir) {
|
|
236
|
+
console.error(
|
|
237
|
+
"This CLI has no bundled registry to install pages from — in the framework repository, run `pnpm registry:build` first."
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
let approved = plan !== null && flags.install && flags.yes && !!registryDir;
|
|
241
|
+
if (plan && flags.install && registryDir && !flags.yes && interactive) {
|
|
242
|
+
p.note(commands.map(show).join("\n"), "Commands to run in " + target);
|
|
186
243
|
const answer = await p.confirm({
|
|
187
|
-
message:
|
|
188
|
-
? `shadcn is not installed yet — install the dependencies (shadcn included) with ${
|
|
244
|
+
message: plan.install
|
|
245
|
+
? `shadcn is not installed yet — install the dependencies (shadcn included) with ${plan.install.command}${workspaceRoot ? " from the workspace root" : ""} and add ${items.length} page(s)?`
|
|
189
246
|
: `Add ${items.length} page(s) with shadcn?`,
|
|
190
247
|
});
|
|
191
248
|
if (bail(answer, `The scaffold is in ${target}; nothing was installed.`))
|
|
@@ -193,27 +250,26 @@ export async function runCreate(
|
|
|
193
250
|
approved = answer;
|
|
194
251
|
}
|
|
195
252
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
pending = plan;
|
|
211
|
-
}
|
|
253
|
+
const pending =
|
|
254
|
+
approved && plan && registryDir
|
|
255
|
+
? await installPages(plan, {
|
|
256
|
+
appRoot,
|
|
257
|
+
interactive,
|
|
258
|
+
show,
|
|
259
|
+
syncContext: {
|
|
260
|
+
appRoot,
|
|
261
|
+
registryDir,
|
|
262
|
+
requires: catalogue.requires,
|
|
263
|
+
frameworkVersion: context.frameworkVersion,
|
|
264
|
+
},
|
|
265
|
+
})
|
|
266
|
+
: commands;
|
|
212
267
|
|
|
213
268
|
const next = {
|
|
214
|
-
packageManager,
|
|
269
|
+
packageManager: workspaceRoot ? ("pnpm" as const) : packageManager,
|
|
215
270
|
installed: approved && pending.length === 0,
|
|
216
271
|
pending,
|
|
272
|
+
workspaceRoot,
|
|
217
273
|
};
|
|
218
274
|
if (interactive) {
|
|
219
275
|
p.note(formatNextSteps(target, next), "Next");
|
package/src/commands/create.ts
CHANGED
|
@@ -9,10 +9,12 @@
|
|
|
9
9
|
*
|
|
10
10
|
* In a terminal it asks for the project name when none is given, then
|
|
11
11
|
* which registry pages to install (`--items a,b` or `--all` answer that
|
|
12
|
-
* without asking). The pages are installed by
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
12
|
+
* without asking). The pages are installed by `intelligo sync` — one
|
|
13
|
+
* `shadcn add` per item, from the registry this CLI carries — after the
|
|
14
|
+
* dependencies (from the root of a parent pnpm workspace when the app is
|
|
15
|
+
* a member of one), and only once you approve the exact commands, or
|
|
16
|
+
* pass `--yes`. `--no-install` stops after the scaffold and prints them
|
|
17
|
+
* instead.
|
|
16
18
|
*/
|
|
17
19
|
|
|
18
20
|
import { existsSync, mkdirSync, readdirSync } from "node:fs";
|
|
@@ -98,6 +100,8 @@ export type NextSteps = {
|
|
|
98
100
|
installed: boolean;
|
|
99
101
|
/** Install commands the developer declined, or that did not get to run. */
|
|
100
102
|
pending?: Command[];
|
|
103
|
+
/** The parent pnpm workspace the app is a member of, installed from its root. */
|
|
104
|
+
workspaceRoot?: string | null;
|
|
101
105
|
};
|
|
102
106
|
|
|
103
107
|
/** A path the reader can paste into a shell, spaces and quotes included. */
|
|
@@ -109,14 +113,20 @@ function shellQuote(value: string): string {
|
|
|
109
113
|
|
|
110
114
|
export function formatNextSteps(target: string, next: NextSteps): string {
|
|
111
115
|
const pm = next.packageManager;
|
|
116
|
+
const appRoot = path.resolve(target);
|
|
117
|
+
const install: Command = {
|
|
118
|
+
command: pm,
|
|
119
|
+
args: ["install"],
|
|
120
|
+
cwd: next.workspaceRoot ?? appRoot,
|
|
121
|
+
};
|
|
112
122
|
return [
|
|
113
|
-
`cd ${shellQuote(path.relative(process.cwd(),
|
|
123
|
+
`cd ${shellQuote(path.relative(process.cwd(), appRoot) || ".")}`,
|
|
114
124
|
"cp .env.example .env.local # then fill it in",
|
|
115
125
|
...(next.pending?.length
|
|
116
|
-
? next.pending.map(formatCommand)
|
|
126
|
+
? next.pending.map((c) => formatCommand(c, appRoot))
|
|
117
127
|
: next.installed
|
|
118
128
|
? []
|
|
119
|
-
: [
|
|
129
|
+
: [formatCommand(install, appRoot)]),
|
|
120
130
|
`${pm === "npm" ? "npm run" : pm} dev`,
|
|
121
131
|
].join("\n");
|
|
122
132
|
}
|
package/src/commands/doctor.ts
CHANGED
|
@@ -10,6 +10,12 @@ import { parseEnv } from "node:util";
|
|
|
10
10
|
|
|
11
11
|
import { inspectMigrationChain, readMigrationChain } from "../migrations.js";
|
|
12
12
|
import { readManifest } from "../manifest.js";
|
|
13
|
+
import {
|
|
14
|
+
checkExports,
|
|
15
|
+
hasObjectKey,
|
|
16
|
+
reexportedSource,
|
|
17
|
+
stripComments,
|
|
18
|
+
} from "../module-exports.js";
|
|
13
19
|
import {
|
|
14
20
|
MODEL_CATALOGUE_LOCATIONS,
|
|
15
21
|
readCatalogueModelIds,
|
|
@@ -38,17 +44,6 @@ export type RegistryRequires = {
|
|
|
38
44
|
items: Record<string, ItemRequires>;
|
|
39
45
|
};
|
|
40
46
|
|
|
41
|
-
/**
|
|
42
|
-
* Block and line comments removed, so a check cannot be satisfied — or
|
|
43
|
-
* defeated — by prose. The composition root's own doc comment names
|
|
44
|
-
* `registerModels` in several of the templates.
|
|
45
|
-
*/
|
|
46
|
-
function stripComments(text: string): string {
|
|
47
|
-
return text
|
|
48
|
-
.replace(/\/\*[\s\S]*?\*\//g, "")
|
|
49
|
-
.replace(/(^|[^:])\/\/.*$/gm, "$1");
|
|
50
|
-
}
|
|
51
|
-
|
|
52
47
|
/**
|
|
53
48
|
* templates/registry-requires.json is a build-time copy of
|
|
54
49
|
* packages/registry/requires.json (scripts/sync-registry-requires.mjs),
|
|
@@ -328,13 +323,17 @@ export function runChecks(options: DoctorOptions = {}): CheckResult[] {
|
|
|
328
323
|
[".ts", ".tsx", ".js", ".jsx", ".json", ""].some((ext) =>
|
|
329
324
|
existsSync(path.join(root, rel + ext))
|
|
330
325
|
);
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
326
|
+
// lib/plans.ts and whatever it re-exports — a catalogue defined in
|
|
327
|
+
// a workspace package counts — comments stripped.
|
|
328
|
+
const plansFile = ["lib/plans.ts", "lib/plans.tsx"]
|
|
329
|
+
.map((rel) => path.join(root, rel))
|
|
330
|
+
.find((file) => existsSync(file));
|
|
331
|
+
const plans = plansFile ? reexportedSource(plansFile, root) : null;
|
|
334
332
|
|
|
335
333
|
for (const [name, item] of Object.entries(requires.items)) {
|
|
336
334
|
if (!existsSync(path.join(root, item.marker))) continue;
|
|
337
335
|
const problems: string[] = [];
|
|
336
|
+
const notes: string[] = [];
|
|
338
337
|
|
|
339
338
|
for (const dep of item.items ?? []) {
|
|
340
339
|
const marker = requires.items[dep]?.marker;
|
|
@@ -350,23 +349,22 @@ export function runChecks(options: DoctorOptions = {}): CheckResult[] {
|
|
|
350
349
|
.map((ext) => path.join(root, file + ext))
|
|
351
350
|
.find((p) => existsSync(p));
|
|
352
351
|
if (!abs) continue; // reported above as a missing file
|
|
353
|
-
const
|
|
354
|
-
const missing = names.filter(
|
|
355
|
-
(n) =>
|
|
356
|
-
!new RegExp(
|
|
357
|
-
`export\\s+(?:default\\s+)?(?:async\\s+)?(?:const|function\\*?|let|var|class)\\s+${n}\\b`
|
|
358
|
-
).test(source) &&
|
|
359
|
-
!new RegExp(`export\\s*\\{[^}]*\\b${n}\\b`).test(source)
|
|
360
|
-
);
|
|
352
|
+
const { missing, unresolved } = checkExports(abs, names, root);
|
|
361
353
|
if (missing.length) {
|
|
362
354
|
problems.push(`${file} must export ${missing.join(", ")}`);
|
|
355
|
+
} else if (unresolved.length) {
|
|
356
|
+
notes.push(
|
|
357
|
+
`${file}: could not read ${unresolved.map((u) => `\`export * from "${u}"\``).join(", ")} — assumed to provide ${names.join(", ")}`
|
|
358
|
+
);
|
|
363
359
|
}
|
|
364
360
|
}
|
|
365
361
|
for (const feature of item.features ?? []) {
|
|
366
|
-
if (
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
362
|
+
if (!plans || hasObjectKey(plans.text, feature)) continue;
|
|
363
|
+
if (plans.unresolved.length) {
|
|
364
|
+
notes.push(
|
|
365
|
+
`the "${feature}" feature key is not in lib/plans.ts, and ${plans.unresolved.join(", ")} could not be read to confirm it`
|
|
366
|
+
);
|
|
367
|
+
} else {
|
|
370
368
|
problems.push(
|
|
371
369
|
`register the "${feature}" feature key in lib/plans.ts — an unregistered key is denied (403)`
|
|
372
370
|
);
|
|
@@ -375,7 +373,9 @@ export function runChecks(options: DoctorOptions = {}): CheckResult[] {
|
|
|
375
373
|
|
|
376
374
|
results.push(
|
|
377
375
|
problems.length === 0
|
|
378
|
-
?
|
|
376
|
+
? notes.length === 0
|
|
377
|
+
? { name: `item:${name}`, status: "ok", detail: "requirements met" }
|
|
378
|
+
: { name: `item:${name}`, status: "warn", detail: notes.join("; ") }
|
|
379
379
|
: {
|
|
380
380
|
name: `item:${name}`,
|
|
381
381
|
status: "error",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
* `migrate` can take it over.
|
|
38
38
|
*
|
|
39
39
|
* Beside `state` it carries `exitCode`, `chain`, `applied`, `pending`,
|
|
40
|
-
* `unknown`, `legacy` and `adoptable`.
|
|
40
|
+
* `unknown`, `legacy`, `legacyMissing` and `adoptable`.
|
|
41
41
|
*/
|
|
42
42
|
|
|
43
43
|
import { createHash } from "node:crypto";
|
|
@@ -64,6 +64,11 @@ export type MigrateCheckResult = {
|
|
|
64
64
|
legacy: string[];
|
|
65
65
|
/** Length of the pre-1.0 chain (0 when this checkout ships none). */
|
|
66
66
|
legacyChainLength: number;
|
|
67
|
+
/**
|
|
68
|
+
* Pre-1.0 migrations the database has not run, by tag, in chain
|
|
69
|
+
* order — empty unless it ran some of them.
|
|
70
|
+
*/
|
|
71
|
+
legacyMissing: string[];
|
|
67
72
|
/**
|
|
68
73
|
* The database ran the whole pre-1.0 chain and not the baseline:
|
|
69
74
|
* `migrate` records the baseline as applied without running it.
|
|
@@ -74,11 +79,11 @@ export type MigrateCheckResult = {
|
|
|
74
79
|
/** The pre-1.0 chain's tags and hashes, if this checkout ships them. */
|
|
75
80
|
export function readLegacyChain(
|
|
76
81
|
migrationsDir: string
|
|
77
|
-
): Array<{ tag: string; hash: string }> {
|
|
82
|
+
): Array<{ tag: string; hash: string; alternates?: string[] }> {
|
|
78
83
|
const file = path.join(migrationsDir, "legacy-chain.json");
|
|
79
84
|
if (!existsSync(file)) return [];
|
|
80
85
|
const parsed = JSON.parse(readFileSync(file, "utf8")) as {
|
|
81
|
-
entries?: Array<{ tag: string; hash: string }>;
|
|
86
|
+
entries?: Array<{ tag: string; hash: string; alternates?: string[] }>;
|
|
82
87
|
};
|
|
83
88
|
return parsed.entries ?? [];
|
|
84
89
|
}
|
|
@@ -118,7 +123,13 @@ export async function migrateCheck(
|
|
|
118
123
|
}
|
|
119
124
|
|
|
120
125
|
const legacyChain = readLegacyChain(migrationsDir);
|
|
121
|
-
|
|
126
|
+
// A migration can be recorded under more than one hash: npm's
|
|
127
|
+
// 1.0.0-beta.6 shipped different bytes for three of them.
|
|
128
|
+
const legacyByHash = new Map(
|
|
129
|
+
legacyChain.flatMap((e) =>
|
|
130
|
+
[e.hash, ...(e.alternates ?? [])].map((h) => [h, e.tag] as const)
|
|
131
|
+
)
|
|
132
|
+
);
|
|
122
133
|
|
|
123
134
|
const appliedHashes = new Set(rows.map((r) => r.hash));
|
|
124
135
|
const applied: string[] = [];
|
|
@@ -144,6 +155,10 @@ export async function migrateCheck(
|
|
|
144
155
|
unmanaged: tableMissing || appliedHashes.size === 0,
|
|
145
156
|
legacy,
|
|
146
157
|
legacyChainLength: legacyChain.length,
|
|
158
|
+
legacyMissing:
|
|
159
|
+
legacy.length > 0
|
|
160
|
+
? legacyChain.map((e) => e.tag).filter((t) => !legacy.includes(t))
|
|
161
|
+
: [],
|
|
147
162
|
adoptable:
|
|
148
163
|
legacyChain.length > 0 &&
|
|
149
164
|
legacy.length === legacyChain.length &&
|
|
@@ -185,12 +200,8 @@ export function formatMigrateCheck(
|
|
|
185
200
|
`already there), then applies what follows. Tables the old chain ` +
|
|
186
201
|
`created that the framework no longer owns are left untouched.`
|
|
187
202
|
);
|
|
188
|
-
} else if (r
|
|
189
|
-
lines.push(
|
|
190
|
-
`✗ This database ran ${r.legacy.length} of the ${r.legacyChainLength} ` +
|
|
191
|
-
`pre-1.0 migrations. Finish that chain with @intelligo-dev/core ` +
|
|
192
|
-
`1.0.0-beta.7 (\`intelligo migrate\`) before upgrading.`
|
|
193
|
-
);
|
|
203
|
+
} else if (isPartialLegacy(r)) {
|
|
204
|
+
lines.push(`✗ ${partialLegacyMessage(r)}`);
|
|
194
205
|
}
|
|
195
206
|
|
|
196
207
|
if (r.unknown.length > 0) {
|
|
@@ -221,6 +232,35 @@ export function isPartialLegacy(r: MigrateCheckResult): boolean {
|
|
|
221
232
|
return r.legacy.length > 0 && r.legacy.length < r.legacyChainLength;
|
|
222
233
|
}
|
|
223
234
|
|
|
235
|
+
/**
|
|
236
|
+
* The last pre-1.0 migration any published `@intelligo-dev/core`
|
|
237
|
+
* carries: 1.0.0-beta.6 shipped the chain through it, and the versions
|
|
238
|
+
* that carried the rest were never published.
|
|
239
|
+
*/
|
|
240
|
+
export const LAST_PUBLISHED_LEGACY_TAG = "0042_sessions_active_organization_id";
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Why a partial pre-1.0 chain is refused and where the way forward is
|
|
244
|
+
* written down. No published version finishes the chain, so the
|
|
245
|
+
* message names what is missing and points at the README's options
|
|
246
|
+
* instead of at a version to install.
|
|
247
|
+
*/
|
|
248
|
+
export function partialLegacyMessage(r: MigrateCheckResult): string {
|
|
249
|
+
const shown = r.legacyMissing.slice(0, 6);
|
|
250
|
+
const more = r.legacyMissing.length - shown.length;
|
|
251
|
+
return (
|
|
252
|
+
`This database ran ${r.legacy.length} of the ${r.legacyChainLength} ` +
|
|
253
|
+
`pre-1.0 migrations; it has not run ${shown.join(", ")}` +
|
|
254
|
+
`${more > 0 ? ` and ${more} more` : ""}. No published ` +
|
|
255
|
+
`@intelligo-dev/core finishes that chain: 1.0.0-beta.6 ships it ` +
|
|
256
|
+
`through ${LAST_PUBLISHED_LEGACY_TAG}, and the versions that carried ` +
|
|
257
|
+
`the rest never reached npm. Apply the missing migrations' SQL from ` +
|
|
258
|
+
`your own copy of it, or bring the schema to the baseline and record ` +
|
|
259
|
+
`it as applied — see "Databases from before 1.0" in README.md in ` +
|
|
260
|
+
`@intelligo-dev/core's src/db/migrations.`
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
|
+
|
|
224
264
|
export type MigrateState =
|
|
225
265
|
"up_to_date" | "pending" | "fresh" | "ahead" | "unmanaged" | "legacy";
|
|
226
266
|
|
|
@@ -252,6 +292,7 @@ export function formatMigrateCheckJson(
|
|
|
252
292
|
pending: r.pending,
|
|
253
293
|
unknown: r.unknown,
|
|
254
294
|
legacy: r.legacy,
|
|
295
|
+
legacyMissing: r.legacyMissing,
|
|
255
296
|
adoptable: r.adoptable,
|
|
256
297
|
});
|
|
257
298
|
}
|
package/src/commands/migrate.ts
CHANGED
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
hashMigration,
|
|
35
35
|
isPartialLegacy,
|
|
36
36
|
migrateCheck,
|
|
37
|
+
partialLegacyMessage,
|
|
37
38
|
type MigrateCheckResult,
|
|
38
39
|
} from "./migrate-check.js";
|
|
39
40
|
|
|
@@ -68,14 +69,7 @@ export function decideApply(
|
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
if (isPartialLegacy(check)) {
|
|
71
|
-
return {
|
|
72
|
-
action: "refuse",
|
|
73
|
-
reason:
|
|
74
|
-
`This database ran ${check.legacy.length} of the ` +
|
|
75
|
-
`${check.legacyChainLength} pre-1.0 migrations. Finish that chain ` +
|
|
76
|
-
`with @intelligo-dev/core 1.0.0-beta.7 (\`intelligo migrate\`) ` +
|
|
77
|
-
`before upgrading.`,
|
|
78
|
-
};
|
|
72
|
+
return { action: "refuse", reason: partialLegacyMessage(check) };
|
|
79
73
|
}
|
|
80
74
|
|
|
81
75
|
if (check.adoptable) {
|