@intelligo-dev/cli 1.0.0-beta.13 → 1.0.0-beta.15
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 +65 -2
- package/dist/args.d.ts +10 -0
- package/dist/args.d.ts.map +1 -0
- package/dist/args.js +20 -0
- package/dist/args.js.map +1 -0
- package/dist/bin.js +103 -22
- 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 +28 -2
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/create-flow.d.ts +8 -1
- package/dist/commands/create-flow.d.ts.map +1 -1
- package/dist/commands/create-flow.js +101 -34
- package/dist/commands/create-flow.js.map +1 -1
- package/dist/commands/create.d.ts +24 -4
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +57 -14
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/doctor.d.ts +2 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +123 -35
- 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 +109 -0
- package/dist/commands/sync.d.ts.map +1 -0
- package/dist/commands/sync.js +392 -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/env-files.d.ts +11 -0
- package/dist/env-files.d.ts.map +1 -1
- package/dist/env-files.js +28 -9
- package/dist/env-files.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/args.ts +25 -0
- package/src/bin.ts +124 -22
- package/src/commands/add.ts +39 -12
- package/src/commands/create-flow.ts +119 -29
- package/src/commands/create.ts +82 -14
- package/src/commands/doctor.ts +156 -47
- 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 +574 -0
- package/src/commands/upgrade-check.ts +4 -1
- package/src/env-files.ts +28 -7
- 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/admin-page/admin-page.tsx.tpl +96 -24
- package/templates/app-scaffold/gitignore.tpl +25 -0
- package/templates/app-scaffold/intelligo.ts.tpl +6 -47
- package/templates/app-scaffold/next.config.mjs.tpl +31 -2
- package/templates/app-scaffold/package.json.tpl +2 -2
- package/templates/manifest.json +40 -3
- package/templates/pnpm-standalone/npmrc.tpl +6 -0
- package/templates/pnpm-standalone/pnpm-workspace.yaml.tpl +10 -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 +66 -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 +58 -0
- package/templates/registry/popover-morph.json +22 -0
- package/templates/registry/popover.json +22 -0
- package/templates/registry/pricing.json +117 -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 +2960 -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 +3 -3
- package/templates/registry-requires.json +30 -4
- package/templates/vitest/server-only.ts.tpl +7 -0
- package/templates/vitest/vitest.config.ts.tpl +37 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Message files under `intelligo sync`: the registry's keys an app's
|
|
3
|
+
* copy lacks, the merge that keeps the app's values, and the other
|
|
4
|
+
* locales checked against the app's English copy.
|
|
5
|
+
*/
|
|
6
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
7
|
+
import path from "node:path";
|
|
8
|
+
const isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
9
|
+
/** Dotted paths of every leaf in `registry` that `app` lacks. */
|
|
10
|
+
export function missingMessageKeys(registry, app, prefix = "") {
|
|
11
|
+
return Object.entries(registry).flatMap(([key, value]) => {
|
|
12
|
+
const at = prefix ? `${prefix}.${key}` : key;
|
|
13
|
+
if (!(key in app))
|
|
14
|
+
return [at];
|
|
15
|
+
const mine = app[key];
|
|
16
|
+
return isObject(value) && isObject(mine)
|
|
17
|
+
? missingMessageKeys(value, mine, at)
|
|
18
|
+
: [];
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The registry's messages with the app's copy laid over them: every key
|
|
23
|
+
* the registry has is present, every value the app set wins, and keys
|
|
24
|
+
* only the app has (its own nav entries, product copy) are kept.
|
|
25
|
+
*/
|
|
26
|
+
export function mergeMessages(registry, app) {
|
|
27
|
+
const out = {};
|
|
28
|
+
for (const [key, value] of Object.entries(registry)) {
|
|
29
|
+
const mine = app[key];
|
|
30
|
+
out[key] =
|
|
31
|
+
key in app
|
|
32
|
+
? isObject(value) && isObject(mine)
|
|
33
|
+
? mergeMessages(value, mine)
|
|
34
|
+
: mine
|
|
35
|
+
: value;
|
|
36
|
+
}
|
|
37
|
+
for (const [key, value] of Object.entries(app)) {
|
|
38
|
+
if (!(key in out))
|
|
39
|
+
out[key] = value;
|
|
40
|
+
}
|
|
41
|
+
return out;
|
|
42
|
+
}
|
|
43
|
+
export const isMessages = (target) => target.startsWith("messages/") && target.endsWith(".json");
|
|
44
|
+
/** The locale the registry ships messages in. */
|
|
45
|
+
const SOURCE_LOCALE = "en";
|
|
46
|
+
/**
|
|
47
|
+
* The app's locales, from `locales: [...]` in i18n/routing.ts — the
|
|
48
|
+
* source locale alone when there is no such file or list.
|
|
49
|
+
*/
|
|
50
|
+
export function appLocales(appRoot) {
|
|
51
|
+
const file = path.join(appRoot, "i18n", "routing.ts");
|
|
52
|
+
if (!existsSync(file))
|
|
53
|
+
return [SOURCE_LOCALE];
|
|
54
|
+
const list = /\blocales\s*:\s*\[([^\]]*)\]/.exec(readFileSync(file, "utf8"));
|
|
55
|
+
const locales = [...(list?.[1] ?? "").matchAll(/["'`]([^"'`]+)["'`]/g)].map((m) => m[1]);
|
|
56
|
+
return locales.length > 0 ? locales : [SOURCE_LOCALE];
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Every other locale's copy of the namespaces the registry ships,
|
|
60
|
+
* against the app's English file on disk — the merged copy, product
|
|
61
|
+
* keys included, which is what the other locales translate. A missing
|
|
62
|
+
* file lacks every key.
|
|
63
|
+
*/
|
|
64
|
+
export function localeEntries(appRoot, files) {
|
|
65
|
+
const others = appLocales(appRoot).filter((l) => l !== SOURCE_LOCALE);
|
|
66
|
+
if (others.length === 0)
|
|
67
|
+
return [];
|
|
68
|
+
const prefix = `messages/${SOURCE_LOCALE}/`;
|
|
69
|
+
const entries = [];
|
|
70
|
+
for (const { item, target } of files) {
|
|
71
|
+
if (!target.startsWith(prefix) || !target.endsWith(".json"))
|
|
72
|
+
continue;
|
|
73
|
+
const english = path.join(appRoot, target);
|
|
74
|
+
if (!existsSync(english))
|
|
75
|
+
continue;
|
|
76
|
+
const source = JSON.parse(readFileSync(english, "utf8"));
|
|
77
|
+
for (const locale of others) {
|
|
78
|
+
const rel = `messages/${locale}/${target.slice(prefix.length)}`;
|
|
79
|
+
const abs = path.join(appRoot, rel);
|
|
80
|
+
const missingKeys = missingMessageKeys(source, existsSync(abs) ? JSON.parse(readFileSync(abs, "utf8")) : {});
|
|
81
|
+
entries.push(missingKeys.length > 0
|
|
82
|
+
? { item, path: rel, state: "locale-behind", missingKeys }
|
|
83
|
+
: { item, path: rel, state: "current" });
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return entries;
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=sync-messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync-messages.js","sourceRoot":"","sources":["../../src/commands/sync-messages.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,IAAI,MAAM,WAAW,CAAC;AAI7B,MAAM,QAAQ,GAAG,CAAC,CAAU,EAAa,EAAE,CACzC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAE3D,iEAAiE;AACjE,MAAM,UAAU,kBAAkB,CAChC,QAAc,EACd,GAAS,EACT,MAAM,GAAG,EAAE;IAEX,OAAO,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QACvD,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;QAC7C,IAAI,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC;YAAE,OAAO,CAAC,EAAE,CAAC,CAAC;QAC/B,MAAM,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;QACtB,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC;YACtC,CAAC,CAAC,kBAAkB,C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CAAC;QACjE,KAAK,MAAM,MAAM,IAAI,MAAM,EAAE,CAAC;YAC5B,MAAM,GAAG,GAAG,YAAY,MAAM,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;YAChE,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;YACpC,MAAM,WAAW,GAAG,kBAAkB,CACpC,MAAM,EACN,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAE,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,CAAU,CAAC,CAAC,CAAC,EAAE,CACvE,CAAC;YACF,OAAO,CAAC,IAAI,CACV,WAAW,CAAC,MAAM,GAAG,CAAC;gBACpB,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE;gBAC1D,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,CAC1C,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scaffold files a registry install replaces. `intelligo create`
|
|
3
|
+
* writes app/globals.css, the theme provider and lib/utils.ts; the
|
|
4
|
+
* design-system base and the items overwrite them, and the scaffold's
|
|
5
|
+
* record has to let go of them or `upgrade --check` reports them as
|
|
6
|
+
* the app's own edits forever.
|
|
7
|
+
*/
|
|
8
|
+
/** The `intelligo create` feature whose files an install may replace. */
|
|
9
|
+
export declare const SCAFFOLD_FEATURE = "app-scaffold";
|
|
10
|
+
/**
|
|
11
|
+
* The scaffold files an install has made the registry's: a file an
|
|
12
|
+
* installed item ships, the Tailwind stylesheet once the design-system
|
|
13
|
+
* base is in (it rewrites the tokens), or any scaffold file the install
|
|
14
|
+
* changed (shadcn's own `utils`, `sonner`). Seams stay the app's, and
|
|
15
|
+
* so do the files shadcn only extends. Left in the scaffold's record,
|
|
16
|
+
* each would read `customized` in `upgrade --check` forever.
|
|
17
|
+
*/
|
|
18
|
+
export declare function scaffoldHandover(input: {
|
|
19
|
+
scaffold: readonly string[];
|
|
20
|
+
changed: ReadonlySet<string>;
|
|
21
|
+
shipped: ReadonlySet<string>;
|
|
22
|
+
seams: Readonly<Record<string, string>>;
|
|
23
|
+
css: string | null;
|
|
24
|
+
}): string[];
|
|
25
|
+
/**
|
|
26
|
+
* The scaffold's recorded files as they are before an install, and
|
|
27
|
+
* afterwards the ones the install made the registry's.
|
|
28
|
+
*/
|
|
29
|
+
export declare function snapshotScaffold(appRoot: string): {
|
|
30
|
+
handedOver: (input: {
|
|
31
|
+
shipped: ReadonlySet<string>;
|
|
32
|
+
seams: Readonly<Record<string, string>>;
|
|
33
|
+
css: string | null;
|
|
34
|
+
}) => string[];
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=sync-scaffold.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync-scaffold.d.ts","sourceRoot":"","sources":["../../src/commands/sync-scaffold.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,yEAAyE;AACzE,eAAO,MAAM,gBAAgB,iBAAiB,CAAC;AAY/C;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE;IACtC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC7B,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC7B,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACxC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CACpB,GAAG,MAAM,EAAE,CAOX;AAMD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG;IACjD,UAAU,EAAE,CAAC,KAAK,EAAE;QAClB,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;QAC7B,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;QACxC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;KACpB,KAAK,MAAM,EAAE,CAAC;CAChB,CAmBA"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scaffold files a registry install replaces. `intelligo create`
|
|
3
|
+
* writes app/globals.css, the theme provider and lib/utils.ts; the
|
|
4
|
+
* design-system base and the items overwrite them, and the scaffold's
|
|
5
|
+
* record has to let go of them or `upgrade --check` reports them as
|
|
6
|
+
* the app's own edits forever.
|
|
7
|
+
*/
|
|
8
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
9
|
+
import path from "node:path";
|
|
10
|
+
import { readManifest } from "../manifest.js";
|
|
11
|
+
/** The `intelligo create` feature whose files an install may replace. */
|
|
12
|
+
export const SCAFFOLD_FEATURE = "app-scaffold";
|
|
13
|
+
/**
|
|
14
|
+
* Scaffold files the install extends in place rather than replaces:
|
|
15
|
+
* shadcn adds dependencies to package.json and style fields to
|
|
16
|
+
* components.json, and both stay the app's.
|
|
17
|
+
*/
|
|
18
|
+
const EDITED_IN_PLACE = new Set([
|
|
19
|
+
"package.json",
|
|
20
|
+
"components.json",
|
|
21
|
+
]);
|
|
22
|
+
/**
|
|
23
|
+
* The scaffold files an install has made the registry's: a file an
|
|
24
|
+
* installed item ships, the Tailwind stylesheet once the design-system
|
|
25
|
+
* base is in (it rewrites the tokens), or any scaffold file the install
|
|
26
|
+
* changed (shadcn's own `utils`, `sonner`). Seams stay the app's, and
|
|
27
|
+
* so do the files shadcn only extends. Left in the scaffold's record,
|
|
28
|
+
* each would read `customized` in `upgrade --check` forever.
|
|
29
|
+
*/
|
|
30
|
+
export function scaffoldHandover(input) {
|
|
31
|
+
return input.scaffold.filter((file) => !(file in input.seams) &&
|
|
32
|
+
!EDITED_IN_PLACE.has(file) &&
|
|
33
|
+
(input.shipped.has(file) || file === input.css || input.changed.has(file)));
|
|
34
|
+
}
|
|
35
|
+
function readIfExists(file) {
|
|
36
|
+
return existsSync(file) ? readFileSync(file, "utf8") : null;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The scaffold's recorded files as they are before an install, and
|
|
40
|
+
* afterwards the ones the install made the registry's.
|
|
41
|
+
*/
|
|
42
|
+
export function snapshotScaffold(appRoot) {
|
|
43
|
+
const scaffold = (readManifest(appRoot)?.features[SCAFFOLD_FEATURE]?.files ?? []).map((f) => f.path);
|
|
44
|
+
const before = new Map(scaffold.map((f) => [f, readIfExists(path.join(appRoot, f))]));
|
|
45
|
+
return {
|
|
46
|
+
handedOver: (input) => scaffoldHandover({
|
|
47
|
+
...input,
|
|
48
|
+
scaffold,
|
|
49
|
+
changed: new Set(scaffold.filter((f) => readIfExists(path.join(appRoot, f)) !== before.get(f))),
|
|
50
|
+
}),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=sync-scaffold.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync-scaffold.js","sourceRoot":"","sources":["../../src/commands/sync-scaffold.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,yEAAyE;AACzE,MAAM,CAAC,MAAM,gBAAgB,GAAG,cAAc,CAAC;AAE/C;;;;GAIG;AACH,MAAM,eAAe,GAAwB,IAAI,GAAG,CAAC;IACnD,cAAc;IACd,iBAAiB;CAClB,CAAC,CAAC;AAEH;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAMh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,KAAK,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAC7D,CACF;SACF,CAAC;KACL,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `intelligo sync [items…] [--check] [--force]`
|
|
3
|
+
*
|
|
4
|
+
* Keeps an app's installed registry pages exactly what the framework
|
|
5
|
+
* ships. Installing stays the shadcn CLI's job — every item goes in with
|
|
6
|
+
* `shadcn add <item> --yes --overwrite` — and this command adds what
|
|
7
|
+
* shadcn cannot know:
|
|
8
|
+
*
|
|
9
|
+
* - the version: items come from the registry bundled with this CLI, so
|
|
10
|
+
* they match the `@intelligo-dev/*` packages of the same release;
|
|
11
|
+
* - the order: an item that imports a sibling's files lands after it
|
|
12
|
+
* (requires.json `items`);
|
|
13
|
+
* - the seams: files an item ships once for the deployment to own
|
|
14
|
+
* (requires.json `seams`) are put back after the install, and message
|
|
15
|
+
* files are merged key by key, the app's copy winning;
|
|
16
|
+
* - the record: intelligo.manifest.json keeps each installed file's
|
|
17
|
+
* hash, so `--check` can tell a file edited by hand from one a newer
|
|
18
|
+
* registry replaced. Scaffold files an install replaces (globals.css,
|
|
19
|
+
* the theme provider) leave the `app-scaffold` record for this one,
|
|
20
|
+
* so `upgrade --check` stops calling them customized.
|
|
21
|
+
*
|
|
22
|
+
* `--check` installs nothing and exits 1 when any installed file is
|
|
23
|
+
* missing, edited or behind the registry — the gate CI runs.
|
|
24
|
+
*/
|
|
25
|
+
import type { RegistryRequires } from "./doctor.js";
|
|
26
|
+
export { appLocales, mergeMessages, missingMessageKeys, } from "./sync-messages.js";
|
|
27
|
+
export { SCAFFOLD_FEATURE, scaffoldHandover } from "./sync-scaffold.js";
|
|
28
|
+
/** The design-system base: no marker file, installed before any page. */
|
|
29
|
+
export declare const BASE_ITEM = "intelligo";
|
|
30
|
+
export type SyncFileState =
|
|
31
|
+
/** identical to the registry */
|
|
32
|
+
"current"
|
|
33
|
+
/** untouched since the last sync; the registry has a newer version */
|
|
34
|
+
| "outdated"
|
|
35
|
+
/** changed by hand since it was installed */
|
|
36
|
+
| "edited"
|
|
37
|
+
/** differs from the registry, and no sync ever recorded it */
|
|
38
|
+
| "differs"
|
|
39
|
+
/** the registry ships it and the app does not have it */
|
|
40
|
+
| "missing"
|
|
41
|
+
/** a seam: the app's own from the first install on */
|
|
42
|
+
| "seam"
|
|
43
|
+
/** a message file that lacks keys the registry's has */
|
|
44
|
+
| "messages-behind"
|
|
45
|
+
/** another locale's copy of a shipped namespace lacks keys the app's English has */
|
|
46
|
+
| "locale-behind";
|
|
47
|
+
export type SyncEntry = {
|
|
48
|
+
item: string;
|
|
49
|
+
path: string;
|
|
50
|
+
state: SyncFileState;
|
|
51
|
+
/** For `messages-behind` / `locale-behind`: the dotted keys the copy lacks. */
|
|
52
|
+
missingKeys?: string[];
|
|
53
|
+
};
|
|
54
|
+
export type SyncReport = {
|
|
55
|
+
/** The framework version of the bundled registry. */
|
|
56
|
+
version: string;
|
|
57
|
+
/** The items checked, in install order (Intelligo components included). */
|
|
58
|
+
items: string[];
|
|
59
|
+
entries: SyncEntry[];
|
|
60
|
+
};
|
|
61
|
+
export type SyncSelection = {
|
|
62
|
+
ok: true;
|
|
63
|
+
items: string[];
|
|
64
|
+
} | {
|
|
65
|
+
ok: false;
|
|
66
|
+
message: string;
|
|
67
|
+
};
|
|
68
|
+
export type SyncContext = {
|
|
69
|
+
appRoot: string;
|
|
70
|
+
registryDir: string;
|
|
71
|
+
requires: RegistryRequires & {
|
|
72
|
+
seams?: Record<string, string>;
|
|
73
|
+
};
|
|
74
|
+
frameworkVersion: string;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* The items to sync: the ones named, else the ones the manifest
|
|
78
|
+
* recorded. With neither, nothing is guessed — a page at an item's
|
|
79
|
+
* marker path may be the product's own (a custom dashboard), and a sync
|
|
80
|
+
* would replace it — so the message lists what looks installed and asks
|
|
81
|
+
* for names.
|
|
82
|
+
*/
|
|
83
|
+
export declare function selectItems(names: readonly string[], context: SyncContext): SyncSelection;
|
|
84
|
+
/** Blocks in requires.json order, the design-system base first. */
|
|
85
|
+
export declare function installOrder(items: readonly string[], requires: RegistryRequires): string[];
|
|
86
|
+
/** Compare the app against the bundled registry; writes nothing. */
|
|
87
|
+
export declare function syncCheck(items: readonly string[], context: SyncContext): SyncReport;
|
|
88
|
+
export declare function syncCheckExitCode(report: SyncReport): number;
|
|
89
|
+
export declare function formatSyncReport(report: SyncReport): string;
|
|
90
|
+
/** The package version the app resolves for `@intelligo-dev/core`, if any. */
|
|
91
|
+
export declare function installedFrameworkVersion(appRoot: string): string | null;
|
|
92
|
+
/**
|
|
93
|
+
* Record `names` as items this app keeps in sync before any is
|
|
94
|
+
* installed, so a bare `intelligo sync` installs them after an install
|
|
95
|
+
* that did not run or did not finish.
|
|
96
|
+
*/
|
|
97
|
+
export declare function recordItems(names: readonly string[], context: Pick<SyncContext, "appRoot" | "requires" | "frameworkVersion">): void;
|
|
98
|
+
export type SyncApplyOptions = {
|
|
99
|
+
force?: boolean;
|
|
100
|
+
log?: (line: string) => void;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Install `items` from the bundled registry, keep the seams, merge the
|
|
104
|
+
* messages and record what was written. Refuses to overwrite a file
|
|
105
|
+
* edited by hand unless `force` — the edit belongs in a seam, and the
|
|
106
|
+
* refusal says which files.
|
|
107
|
+
*/
|
|
108
|
+
export declare function syncApply(names: readonly string[], context: SyncContext, options?: SyncApplyOptions): Promise<number>;
|
|
109
|
+
//# sourceMappingURL=sync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/commands/sync.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAQH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AA0BpD,OAAO,EACL,UAAU,EACV,aAAa,EACb,kBAAkB,GAC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