@astryxdesign/cli 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +48 -1
- package/README.md +76 -67
- package/api/build/build.test.mjs +37 -0
- package/api/build/build.type.mjs +1 -1
- package/api/build/kit/kit.mjs +31 -1
- package/api/component/_adapter.mjs +14 -28
- package/api/component/integration-import-agreement.test.mjs +318 -0
- package/api/doctor/doctor.d.mts +32 -3
- package/api/doctor/doctor.doc.mjs +2 -1
- package/api/doctor/doctor.mjs +97 -4
- package/api/doctor/doctor.test.mjs +90 -1
- package/api/gap-report/gap-report-worker.d.mts +4 -0
- package/api/gap-report/gap-report-worker.mjs +73 -0
- package/api/gap-report/gap-report.d.mts +81 -0
- package/api/gap-report/gap-report.doc.d.mts +9 -0
- package/api/gap-report/gap-report.doc.mjs +127 -0
- package/api/gap-report/gap-report.mjs +707 -0
- package/api/gap-report/gap-report.test.mjs +1210 -0
- package/api/gap-report/gap-report.type.d.mts +88 -0
- package/api/gap-report/gap-report.type.mjs +69 -0
- package/api/index.d.mts +8 -1
- package/api/index.mjs +24 -1
- package/api/integration/add-contribution.d.mts +44 -0
- package/api/integration/add-contribution.mjs +1160 -0
- package/api/integration/add-contribution.test.mjs +733 -0
- package/api/integration/add-helpers.d.mts +80 -0
- package/api/integration/add-helpers.mjs +333 -0
- package/api/integration/add-helpers.test.mjs +161 -0
- package/api/integration/add-theme.d.mts +10 -0
- package/api/integration/add-theme.mjs +332 -0
- package/api/integration/add-theme.test.mjs +194 -0
- package/api/integration/integration-authoring.type.d.mts +55 -0
- package/api/integration/integration-authoring.type.mjs +76 -0
- package/api/integration/integration-block-exports.test.mjs +4 -0
- package/api/integration/integrationAdd.doc.d.mts +5 -0
- package/api/integration/integrationAdd.doc.mjs +100 -0
- package/api/integration/integrationAddAgentDoc.doc.d.mts +5 -0
- package/api/integration/integrationAddAgentDoc.doc.mjs +49 -0
- package/api/integration/integrationAddCodemod.doc.d.mts +5 -0
- package/api/integration/integrationAddCodemod.doc.mjs +55 -0
- package/api/integration/integrationAddComponent.doc.d.mts +5 -0
- package/api/integration/integrationAddComponent.doc.mjs +49 -0
- package/api/integration/integrationAddDoc.doc.d.mts +5 -0
- package/api/integration/integrationAddDoc.doc.mjs +59 -0
- package/api/integration/integrationAddTemplate.doc.d.mts +5 -0
- package/api/integration/integrationAddTemplate.doc.mjs +55 -0
- package/api/integration/integrationAddTheme.doc.d.mts +5 -0
- package/api/integration/integrationAddTheme.doc.mjs +85 -0
- package/api/integration/integrationPackCheck.doc.d.mts +5 -0
- package/api/integration/integrationPackCheck.doc.mjs +35 -0
- package/api/integration/pack-check.d.mts +27 -0
- package/api/integration/pack-check.mjs +795 -0
- package/api/integration/pack-check.test.mjs +569 -0
- package/api/integration/pack-check.type.d.mts +45 -0
- package/api/integration/pack-check.type.mjs +56 -0
- package/api/integration/public-api.test.mjs +21 -0
- package/api/integration/validate-integration.mjs +221 -11
- package/api/integration/validate-integration.test.mjs +189 -5
- package/api/integration/validateIntegration.doc.mjs +2 -2
- package/api/json/index.ts +1 -0
- package/api/search/search.mjs +19 -1
- package/api/theme/_adapter.d.mts +26 -28
- package/api/theme/_adapter.mjs +101 -38
- package/api/theme/add/add.d.mts +2 -1
- package/api/theme/add/add.mjs +56 -20
- package/api/theme/add/add.test.mjs +1 -0
- package/api/theme/build/build.d.mts +25 -0
- package/api/theme/build/build.mjs +101 -70
- package/api/theme/build/build.test.mjs +77 -44
- package/api/theme/integration-themes.test.mjs +183 -0
- package/api/theme/list/list.d.mts +10 -2
- package/api/theme/list/list.mjs +31 -10
- package/api/theme/list/list.test.mjs +102 -23
- package/api/theme/listThemes.doc.d.mts +1 -5
- package/api/theme/listThemes.doc.mjs +6 -13
- package/api/theme/targets/targets.test.mjs +22 -8
- package/api/theme/theme.d.mts +1 -1
- package/api/theme/theme.mjs +1 -1
- package/api/theme/theme.type.d.mts +9 -0
- package/api/theme/theme.type.mjs +3 -1
- package/api/theme/themeAdd.doc.d.mts +1 -4
- package/api/theme/themeAdd.doc.mjs +31 -31
- package/api/theme/themeBuild.doc.mjs +1 -1
- package/api/theme/themeList.doc.d.mts +1 -4
- package/api/theme/themeList.doc.mjs +7 -15
- package/api/theme/themeListAvailable.doc.d.mts +8 -0
- package/api/theme/themeListAvailable.doc.mjs +57 -0
- package/api/theme/themeTargets.doc.mjs +21 -7
- package/api/upgrade/_adapter.d.mts +2 -0
- package/api/upgrade/_adapter.mjs +1 -0
- package/api/upgrade/registry/registry.d.mts +40 -0
- package/api/upgrade/registry/registry.mjs +1154 -0
- package/api/upgrade/registry/registry.test.mjs +826 -0
- package/api/upgrade/run/run.mjs +49 -8
- package/api/upgrade/status/status.d.mts +6 -4
- package/api/upgrade/status/status.mjs +26 -8
- package/api/upgrade/upgrade.d.mts +2 -2
- package/api/upgrade/upgrade.doc.mjs +33 -9
- package/api/upgrade/upgrade.mjs +34 -7
- package/api/upgrade/upgrade.test.mjs +198 -8
- package/api/upgrade/upgrade.type.d.mts +90 -1
- package/api/upgrade/upgrade.type.mjs +51 -2
- package/assets/docs/cli-integrations.doc.mjs +152 -28
- package/assets/docs/getting-started.doc.mjs +1 -1
- package/assets/docs/{shadcn-compatibility.doc.mjs → shadcn-compatibility.doc.draft.mjs} +23 -13
- package/assets/docs/styling.doc.mjs +3 -3
- package/assets/docs/theme.doc.dense.mjs +2 -2
- package/assets/docs/theme.doc.mjs +23 -13
- package/assets/docs/theme.doc.zh.mjs +1 -1
- package/assets/templates/blocks/components/BaseTypeahead/BaseTypeaheadCustomSearch.doc.mjs +2 -1
- package/assets/templates/blocks/components/BaseTypeahead/BaseTypeaheadCustomSearch.tsx +38 -12
- package/assets/templates/blocks/components/BaseTypeahead/BaseTypeaheadShowcase.doc.mjs +15 -0
- package/assets/templates/blocks/components/BaseTypeahead/BaseTypeaheadShowcase.tsx +87 -0
- package/assets/templates/blocks/components/BottomSheet/BottomSheetSwitcherReviewFlow.doc.mjs +23 -0
- package/assets/templates/blocks/components/BottomSheet/BottomSheetSwitcherReviewFlow.tsx +75 -0
- package/assets/templates/blocks/components/BreadcrumbItem/BreadcrumbItemShowcase.tsx +5 -19
- package/assets/templates/blocks/components/Center/CenterHorizontal.doc.mjs +3 -2
- package/assets/templates/blocks/components/Center/CenterHorizontal.tsx +4 -5
- package/assets/templates/blocks/components/Toast/ToastAction.tsx +2 -1
- package/assets/templates/blocks/components/Toast/ToastDeduplication.tsx +2 -1
- package/assets/templates/blocks/components/Toast/ToastDismiss.tsx +2 -1
- package/assets/templates/blocks/components/Toast/ToastShowcase.tsx +2 -1
- package/assets/templates/blocks/components/Toast/ToastStacking.tsx +2 -1
- package/assets/templates/blocks/components/Toast/ToastTypes.tsx +2 -1
- package/assets/templates/pages/dashboard/template.doc.mjs +2 -2
- package/assets/templates/pages/dashboard-alert-rail/template.doc.mjs +3 -2
- package/assets/templates/pages/dashboard-cohort-funnel/template.doc.mjs +3 -2
- package/assets/templates/pages/dashboard-comparison/template.doc.mjs +3 -3
- package/assets/templates/pages/dashboard-composition/template.doc.mjs +2 -2
- package/assets/templates/pages/dashboard-progress/template.doc.mjs +2 -2
- package/assets/templates/pages/dashboard-scorecard/template.doc.mjs +2 -2
- package/assets/templates/themes/butter/butterTheme.ts +3 -3
- package/assets/templates/themes/neutral/neutralTheme.ts +2 -2
- package/assets/templates/themes/stone/stoneTheme.ts +3 -3
- package/assets/theme.template.ts +4 -7
- package/authoring/config/config.doc.mjs +9 -1
- package/authoring/config/parse.d.mts +2 -0
- package/authoring/config/parse.mjs +28 -3
- package/authoring/config/parse.test.mjs +25 -3
- package/authoring/config/type.ts +3 -0
- package/authoring/doctypes/_schema.d.mts +3 -0
- package/authoring/doctypes/_schema.mjs +6 -1
- package/authoring/doctypes/base/type.ts +6 -6
- package/authoring/doctypes/component/component.doc.mjs +6 -0
- package/authoring/doctypes/component/type.ts +2 -0
- package/authoring/gap-report/parse.d.mts +63 -0
- package/authoring/gap-report/parse.mjs +121 -0
- package/authoring/gap-report/parse.test.mjs +172 -0
- package/authoring/gap-report/type.ts +107 -0
- package/authoring/index.d.mts +1 -0
- package/authoring/index.d.ts +12 -0
- package/authoring/index.mjs +4 -0
- package/authoring/integration/integration.doc.mjs +14 -2
- package/authoring/integration/parse.test.mjs +9 -4
- package/authoring/integration/schema.d.mts +2 -0
- package/authoring/integration/schema.mjs +1 -0
- package/authoring/integration/type.ts +23 -6
- package/authoring/shadcn/receipt.d.mts +219 -0
- package/authoring/shadcn/receipt.mjs +248 -0
- package/authoring/shadcn/receipt.test.mjs +187 -0
- package/authoring/shadcn/source-variants.d.mts +28 -0
- package/authoring/shadcn/source-variants.mjs +176 -0
- package/authoring/shadcn/source-variants.test.mjs +120 -0
- package/clients/cli/commands/build-theme.mjs +54 -19
- package/clients/cli/commands/build-theme.variants.test.mjs +15 -12
- package/clients/cli/commands/component/index.mjs +1 -1
- package/clients/cli/commands/docs.test.mjs +1 -0
- package/clients/cli/commands/doctor-integration.doc.mjs +1 -1
- package/clients/cli/commands/gap-report.doc.mjs +73 -0
- package/clients/cli/commands/gap-report.mjs +114 -0
- package/clients/cli/commands/gap-report.test.mjs +198 -0
- package/clients/cli/commands/import-hint-correctness.test.mjs +88 -0
- package/clients/cli/commands/integration-add.doc.mjs +88 -0
- package/clients/cli/commands/integration-authoring.test.mjs +177 -0
- package/clients/cli/commands/integration-pack.doc.mjs +34 -0
- package/clients/cli/commands/integration-real-world.test.mjs +618 -0
- package/clients/cli/commands/integration.doc.mjs +28 -0
- package/clients/cli/commands/integration.mjs +153 -0
- package/clients/cli/commands/theme-add.doc.mjs +11 -6
- package/clients/cli/commands/theme-list.doc.mjs +21 -5
- package/clients/cli/commands/theme-targets.behavior.test.mjs +19 -2
- package/clients/cli/commands/theme.doc.mjs +2 -2
- package/clients/cli/commands/upgrade.doc.mjs +17 -4
- package/clients/cli/commands/upgrade.mjs +12 -1
- package/clients/cli/commands/upgrade.test.mjs +41 -0
- package/clients/cli/index.mjs +5 -0
- package/clients/cli/lib/component-format.mjs +42 -26
- package/clients/cli/lib/component-format.test.mjs +34 -3
- package/clients/cli/lib/manifest.mjs +12 -0
- package/foundation/config/project-themes.test.mjs +127 -0
- package/foundation/config/project.d.mts +23 -4
- package/foundation/config/project.mjs +96 -9
- package/foundation/config/project.test.mjs +132 -6
- package/foundation/discovery/component-discovery.d.mts +36 -0
- package/foundation/discovery/component-discovery.mjs +96 -0
- package/foundation/discovery/theme-discovery.d.mts +39 -0
- package/foundation/discovery/theme-discovery.mjs +650 -0
- package/foundation/discovery/theme-discovery.test.mjs +375 -0
- package/foundation/discovery/theming-targets.d.mts +16 -0
- package/foundation/discovery/theming-targets.mjs +39 -3
- package/foundation/discovery/theming-targets.test.mjs +139 -0
- package/foundation/integrations/autolink.d.mts +96 -0
- package/foundation/integrations/autolink.mjs +265 -0
- package/foundation/integrations/autolink.test.mjs +430 -0
- package/foundation/integrations/contribution-inventory.d.mts +152 -0
- package/foundation/integrations/contribution-inventory.mjs +497 -0
- package/foundation/integrations/contribution-inventory.test.mjs +361 -0
- package/foundation/integrations/integrations.d.mts +73 -9
- package/foundation/integrations/integrations.mjs +158 -8
- package/foundation/integrations/integrations.test.mjs +152 -29
- package/foundation/integrations/manifest-writer.d.mts +56 -0
- package/foundation/integrations/manifest-writer.mjs +328 -0
- package/foundation/integrations/manifest-writer.test.mjs +229 -0
- package/foundation/integrations/validate-contributions.mjs +81 -6
- package/foundation/response/error-codes.d.mts +4 -1
- package/foundation/response/error-codes.doc.mjs +16 -1
- package/foundation/response/error-codes.mjs +10 -1
- package/foundation/response/response-types.doc.mjs +23 -2
- package/package.json +8 -1
package/api/upgrade/run/run.mjs
CHANGED
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
*
|
|
12
12
|
* Pipeline (--apply): detect installed core → run CORE codemods (before
|
|
13
13
|
* Project.load, so a core CONFIG codemod can repair an otherwise-invalid
|
|
14
|
-
* config) → load config → discover + run INTEGRATION codemods →
|
|
15
|
-
* hooks → render + refresh agent docs
|
|
16
|
-
* Integration DISCOVERY errors skip that
|
|
17
|
-
* before the agent-doc write.
|
|
14
|
+
* config) → load config → discover + run INTEGRATION codemods → reconcile
|
|
15
|
+
* ShadCN-copied compositions → post-codemod hooks → render + refresh agent docs
|
|
16
|
+
* from final post-upgrade state. Integration DISCOVERY errors skip that
|
|
17
|
+
* integration; execution errors abort before the agent-doc write.
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
import * as path from 'node:path';
|
|
@@ -33,6 +33,10 @@ import {
|
|
|
33
33
|
selectIntegrationCodemodsFor,
|
|
34
34
|
runIntegrationCodemodsStep,
|
|
35
35
|
} from '../_adapter.mjs';
|
|
36
|
+
import {
|
|
37
|
+
logRegistryCompositionSummary,
|
|
38
|
+
reconcileRegistryCompositions,
|
|
39
|
+
} from '../registry/registry.mjs';
|
|
36
40
|
import {
|
|
37
41
|
statusUpToDate,
|
|
38
42
|
statusNoCodemods,
|
|
@@ -87,11 +91,32 @@ export async function run(options = {}, {cwd = process.cwd()} = {}) {
|
|
|
87
91
|
}
|
|
88
92
|
const targetVersion = installed.version;
|
|
89
93
|
|
|
94
|
+
const reconcileCompositions = async () => {
|
|
95
|
+
if (options.codemod) return null;
|
|
96
|
+
const result = await reconcileRegistryCompositions(
|
|
97
|
+
{apply, path: path_},
|
|
98
|
+
{
|
|
99
|
+
cwd,
|
|
100
|
+
expectedVersion:
|
|
101
|
+
installed.packageName === '@astryxdesign/core'
|
|
102
|
+
? targetVersion
|
|
103
|
+
: undefined,
|
|
104
|
+
requireExpectedVersion: true,
|
|
105
|
+
},
|
|
106
|
+
);
|
|
107
|
+
if (result.summary.found > 0) {
|
|
108
|
+
logRegistryCompositionSummary(result.summary);
|
|
109
|
+
return result;
|
|
110
|
+
}
|
|
111
|
+
return null;
|
|
112
|
+
};
|
|
113
|
+
|
|
90
114
|
logger.log(`From version: ${currentVersion}`);
|
|
91
115
|
logger.log(`Installed target: ${targetVersion} (${installed.packageName})`);
|
|
92
116
|
|
|
93
117
|
// Up-to-date check — no codemods will run, safe to render agent docs now.
|
|
94
118
|
if (!options.force && semverGte(currentVersion, targetVersion)) {
|
|
119
|
+
const registryResult = await reconcileCompositions();
|
|
95
120
|
const agentDocsPlan = await prepareAgentDocsRefresh({
|
|
96
121
|
cwd,
|
|
97
122
|
installedVersion: targetVersion,
|
|
@@ -104,6 +129,7 @@ export async function run(options = {}, {cwd = process.cwd()} = {}) {
|
|
|
104
129
|
from: currentVersion,
|
|
105
130
|
to: targetVersion,
|
|
106
131
|
agentDocs,
|
|
132
|
+
...(registryResult ? {registryCompositions: registryResult.summary} : {}),
|
|
107
133
|
});
|
|
108
134
|
}
|
|
109
135
|
|
|
@@ -214,6 +240,7 @@ export async function run(options = {}, {cwd = process.cwd()} = {}) {
|
|
|
214
240
|
}
|
|
215
241
|
|
|
216
242
|
if (versionManifests.length === 0 && !hasIntegrationCodemods) {
|
|
243
|
+
const registryResult = await reconcileCompositions();
|
|
217
244
|
// No codemods in range — safe to render agent docs from current state.
|
|
218
245
|
const agentDocsPlan = await prepareAgentDocsRefresh({
|
|
219
246
|
cwd,
|
|
@@ -227,6 +254,7 @@ export async function run(options = {}, {cwd = process.cwd()} = {}) {
|
|
|
227
254
|
from: currentVersion,
|
|
228
255
|
to: targetVersion,
|
|
229
256
|
agentDocs,
|
|
257
|
+
...(registryResult ? {registryCompositions: registryResult.summary} : {}),
|
|
230
258
|
});
|
|
231
259
|
}
|
|
232
260
|
|
|
@@ -244,7 +272,7 @@ export async function run(options = {}, {cwd = process.cwd()} = {}) {
|
|
|
244
272
|
}
|
|
245
273
|
|
|
246
274
|
/**
|
|
247
|
-
* @type {{from: string, to: string, codemods: number, integrations: string[], agentDocsRefreshed: boolean, agentDocs: import('../upgrade.type.mjs').AgentDocsSummary, filesChanged?: number, transformsApplied?: number, errors?: Array<{file: string, codemod: string, error: string}>}}
|
|
275
|
+
* @type {{from: string, to: string, codemods: number, integrations: string[], agentDocsRefreshed: boolean, agentDocs: import('../upgrade.type.mjs').AgentDocsSummary, registryCompositions?: import('../upgrade.type.mjs').RegistryCompositionSummary, filesChanged?: number, transformsApplied?: number, errors?: Array<{file: string, codemod: string, error: string}>}}
|
|
248
276
|
*/
|
|
249
277
|
const receipt = {
|
|
250
278
|
from: currentVersion,
|
|
@@ -269,12 +297,19 @@ export async function run(options = {}, {cwd = process.cwd()} = {}) {
|
|
|
269
297
|
});
|
|
270
298
|
}
|
|
271
299
|
|
|
300
|
+
const registryResult = await reconcileCompositions();
|
|
301
|
+
|
|
272
302
|
const mergedFilesChanged = (coreResult?.totalFilesChanged ?? 0) + (integrationResult?.totalFilesChanged ?? 0);
|
|
273
303
|
const mergedTransformsApplied = (coreResult?.totalTransformsApplied ?? 0) + (integrationResult?.totalTransformsApplied ?? 0);
|
|
274
|
-
const mergedWrittenFiles = [
|
|
304
|
+
const mergedWrittenFiles = [
|
|
305
|
+
...(coreResult?.writtenFiles ?? []),
|
|
306
|
+
...(integrationResult?.writtenFiles ?? []),
|
|
307
|
+
...(registryResult?.writtenFiles ?? []),
|
|
308
|
+
];
|
|
275
309
|
const mergedErrors = [...(coreResult?.errors ?? []), ...(integrationResult?.errors ?? [])];
|
|
310
|
+
const registryFilesChanged = registryResult?.writtenFiles.length ?? 0;
|
|
276
311
|
|
|
277
|
-
if (postCodemodHooks.length > 0 && mergedFilesChanged > 0) {
|
|
312
|
+
if (postCodemodHooks.length > 0 && (mergedFilesChanged > 0 || registryFilesChanged > 0)) {
|
|
278
313
|
const files = uniqueFiles(mergedWrittenFiles).map(file => path.relative(cwd, file));
|
|
279
314
|
try {
|
|
280
315
|
await runPostCodemodHooks(postCodemodHooks, {packageDir: cwd, files, apply: apply || false});
|
|
@@ -290,6 +325,7 @@ export async function run(options = {}, {cwd = process.cwd()} = {}) {
|
|
|
290
325
|
receipt.filesChanged = mergedFilesChanged;
|
|
291
326
|
receipt.transformsApplied = mergedTransformsApplied;
|
|
292
327
|
receipt.errors = mergedErrors;
|
|
328
|
+
if (registryResult) receipt.registryCompositions = registryResult.summary;
|
|
293
329
|
|
|
294
330
|
if (receipt.errors?.length > 0) {
|
|
295
331
|
const msg = `Upgrade completed with ${receipt.errors.length} codemod error${receipt.errors.length === 1 ? '' : 's'}.`;
|
|
@@ -310,7 +346,12 @@ export async function run(options = {}, {cwd = process.cwd()} = {}) {
|
|
|
310
346
|
receipt.agentDocs = completedAgentDocs;
|
|
311
347
|
receipt.agentDocsRefreshed = completedAgentDocs.refreshed;
|
|
312
348
|
|
|
313
|
-
|
|
349
|
+
const registryOk = receipt.registryCompositions?.ok ?? true;
|
|
350
|
+
logger.log(
|
|
351
|
+
registryOk
|
|
352
|
+
? (apply ? 'Upgrade complete' : 'Dry run complete') + '\n'
|
|
353
|
+
: 'Upgrade finished with unresolved registry items\n',
|
|
354
|
+
);
|
|
314
355
|
return {
|
|
315
356
|
type: 'upgrade.run',
|
|
316
357
|
data: /** @type {import('../upgrade.type.mjs').UpgradeRunResponse['data']} */ (/** @type {unknown} */ (receipt)),
|
|
@@ -3,23 +3,25 @@
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* `--from` is at/after the installed target (and no `--force`): nothing to run.
|
|
6
|
-
* @param {{from: string, to: string, agentDocs: import('../upgrade.type.mjs').AgentDocsSummary}} data
|
|
6
|
+
* @param {{from: string, to: string, agentDocs: import('../upgrade.type.mjs').AgentDocsSummary, registryCompositions?: import('../upgrade.type.mjs').RegistryCompositionSummary}} data
|
|
7
7
|
* @returns {import('../upgrade.type.mjs').UpgradeStatusResponse}
|
|
8
8
|
*/
|
|
9
|
-
export function statusUpToDate({ from, to, agentDocs }: {
|
|
9
|
+
export function statusUpToDate({ from, to, agentDocs, registryCompositions }: {
|
|
10
10
|
from: string;
|
|
11
11
|
to: string;
|
|
12
12
|
agentDocs: import("../upgrade.type.mjs").AgentDocsSummary;
|
|
13
|
+
registryCompositions?: import("../upgrade.type.mjs").RegistryCompositionSummary;
|
|
13
14
|
}): import("../upgrade.type.mjs").UpgradeStatusResponse;
|
|
14
15
|
/**
|
|
15
16
|
* No core or integration codemods apply to the requested version range.
|
|
16
|
-
* @param {{from: string, to: string, agentDocs: import('../upgrade.type.mjs').AgentDocsSummary}} data
|
|
17
|
+
* @param {{from: string, to: string, agentDocs: import('../upgrade.type.mjs').AgentDocsSummary, registryCompositions?: import('../upgrade.type.mjs').RegistryCompositionSummary}} data
|
|
17
18
|
* @returns {import('../upgrade.type.mjs').UpgradeStatusResponse}
|
|
18
19
|
*/
|
|
19
|
-
export function statusNoCodemods({ from, to, agentDocs }: {
|
|
20
|
+
export function statusNoCodemods({ from, to, agentDocs, registryCompositions }: {
|
|
20
21
|
from: string;
|
|
21
22
|
to: string;
|
|
22
23
|
agentDocs: import("../upgrade.type.mjs").AgentDocsSummary;
|
|
24
|
+
registryCompositions?: import("../upgrade.type.mjs").RegistryCompositionSummary;
|
|
23
25
|
}): import("../upgrade.type.mjs").UpgradeStatusResponse;
|
|
24
26
|
/**
|
|
25
27
|
* DRY-RUN only: the consumer's astryx.config fails strict validation, but a
|
|
@@ -20,25 +20,43 @@ import {logger} from '../../logger.mjs';
|
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* `--from` is at/after the installed target (and no `--force`): nothing to run.
|
|
23
|
-
* @param {{from: string, to: string, agentDocs: import('../upgrade.type.mjs').AgentDocsSummary}} data
|
|
23
|
+
* @param {{from: string, to: string, agentDocs: import('../upgrade.type.mjs').AgentDocsSummary, registryCompositions?: import('../upgrade.type.mjs').RegistryCompositionSummary}} data
|
|
24
24
|
* @returns {import('../upgrade.type.mjs').UpgradeStatusResponse}
|
|
25
25
|
*/
|
|
26
|
-
export function statusUpToDate({from, to, agentDocs}) {
|
|
26
|
+
export function statusUpToDate({from, to, agentDocs, registryCompositions}) {
|
|
27
27
|
logger.log('✓ Already up to date — no codemods to run.');
|
|
28
28
|
logger.log('Use --force to run codemods anyway.');
|
|
29
|
-
logger.log('Done\n');
|
|
30
|
-
return {
|
|
29
|
+
logger.log(registryCompositions?.ok === false ? 'Finished with unresolved registry items\n' : 'Done\n');
|
|
30
|
+
return {
|
|
31
|
+
type: 'upgrade.status',
|
|
32
|
+
data: {
|
|
33
|
+
status: 'up_to_date',
|
|
34
|
+
from,
|
|
35
|
+
to,
|
|
36
|
+
agentDocs,
|
|
37
|
+
...(registryCompositions ? {registryCompositions} : {}),
|
|
38
|
+
},
|
|
39
|
+
};
|
|
31
40
|
}
|
|
32
41
|
|
|
33
42
|
/**
|
|
34
43
|
* No core or integration codemods apply to the requested version range.
|
|
35
|
-
* @param {{from: string, to: string, agentDocs: import('../upgrade.type.mjs').AgentDocsSummary}} data
|
|
44
|
+
* @param {{from: string, to: string, agentDocs: import('../upgrade.type.mjs').AgentDocsSummary, registryCompositions?: import('../upgrade.type.mjs').RegistryCompositionSummary}} data
|
|
36
45
|
* @returns {import('../upgrade.type.mjs').UpgradeStatusResponse}
|
|
37
46
|
*/
|
|
38
|
-
export function statusNoCodemods({from, to, agentDocs}) {
|
|
47
|
+
export function statusNoCodemods({from, to, agentDocs, registryCompositions}) {
|
|
39
48
|
logger.log('✓ No codemods available for this version range.');
|
|
40
|
-
logger.log('Done\n');
|
|
41
|
-
return {
|
|
49
|
+
logger.log(registryCompositions?.ok === false ? 'Finished with unresolved registry items\n' : 'Done\n');
|
|
50
|
+
return {
|
|
51
|
+
type: 'upgrade.status',
|
|
52
|
+
data: {
|
|
53
|
+
status: 'no_codemods',
|
|
54
|
+
from,
|
|
55
|
+
to,
|
|
56
|
+
agentDocs,
|
|
57
|
+
...(registryCompositions ? {registryCompositions} : {}),
|
|
58
|
+
},
|
|
59
|
+
};
|
|
42
60
|
}
|
|
43
61
|
|
|
44
62
|
/**
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
*
|
|
12
12
|
* @param {UpgradeOptions} [options]
|
|
13
13
|
* @param {{cwd?: string}} [ctx]
|
|
14
|
-
* @returns {Promise<import('./upgrade.type.mjs').UpgradeListResponse | import('./upgrade.type.mjs').UpgradeStatusResponse | import('./upgrade.type.mjs').UpgradeRunResponse>}
|
|
14
|
+
* @returns {Promise<import('./upgrade.type.mjs').UpgradeListResponse | import('./upgrade.type.mjs').UpgradeRegistryResponse | import('./upgrade.type.mjs').UpgradeStatusResponse | import('./upgrade.type.mjs').UpgradeRunResponse>}
|
|
15
15
|
*/
|
|
16
16
|
export function upgrade(options?: UpgradeOptions, { cwd }?: {
|
|
17
17
|
cwd?: string;
|
|
18
|
-
}): Promise<import("./upgrade.type.mjs").UpgradeListResponse | import("./upgrade.type.mjs").UpgradeStatusResponse | import("./upgrade.type.mjs").UpgradeRunResponse>;
|
|
18
|
+
}): Promise<import("./upgrade.type.mjs").UpgradeListResponse | import("./upgrade.type.mjs").UpgradeRegistryResponse | import("./upgrade.type.mjs").UpgradeStatusResponse | import("./upgrade.type.mjs").UpgradeRunResponse>;
|
|
19
19
|
export type UpgradeOptions = import("./upgrade.type.mjs").UpgradeOptions;
|
|
@@ -12,8 +12,7 @@ export const doc = {
|
|
|
12
12
|
kind: 'api',
|
|
13
13
|
name: 'upgrade',
|
|
14
14
|
displayName: 'upgrade()',
|
|
15
|
-
summary:
|
|
16
|
-
'Run version-migration codemods and refresh the managed agent-docs block.',
|
|
15
|
+
summary: 'Run version migrations and reconcile copied compositions.',
|
|
17
16
|
description:
|
|
18
17
|
'Migrates project source from a previous Astryx version to the currently ' +
|
|
19
18
|
'installed one by running the registered codemods, and compares the fully ' +
|
|
@@ -22,17 +21,26 @@ export const doc = {
|
|
|
22
21
|
'writes the prepared block only after selected codemods and hooks succeed. ' +
|
|
23
22
|
'Core codemods run before ' +
|
|
24
23
|
'the config is loaded so a config codemod can repair an otherwise-invalid ' +
|
|
25
|
-
'astryx.config.'
|
|
24
|
+
'astryx.config. Copied compositions carry adjacent receipts with exact canonical and format-specific install bases; upgrade ' +
|
|
25
|
+
'compares those installed bases with the matching registry release, updates pristine ' +
|
|
26
|
+
'files, merges non-overlapping edits, and leaves conflicting originals untouched.',
|
|
26
27
|
importPath: '@astryxdesign/cli/api',
|
|
27
28
|
signature:
|
|
28
|
-
'upgrade(options?: UpgradeOptions, ctx?: {cwd?: string}): Promise<UpgradeListResponse | UpgradeStatusResponse | UpgradeRunResponse>',
|
|
29
|
-
keywords: [
|
|
29
|
+
'upgrade(options?: UpgradeOptions, ctx?: {cwd?: string}): Promise<UpgradeListResponse | UpgradeRegistryResponse | UpgradeStatusResponse | UpgradeRunResponse>',
|
|
30
|
+
keywords: [
|
|
31
|
+
'upgrade',
|
|
32
|
+
'migrate',
|
|
33
|
+
'codemod',
|
|
34
|
+
'migration',
|
|
35
|
+
'version',
|
|
36
|
+
'registry',
|
|
37
|
+
],
|
|
30
38
|
params: [
|
|
31
39
|
{
|
|
32
40
|
name: 'options.from',
|
|
33
41
|
type: 'string',
|
|
34
42
|
description:
|
|
35
|
-
'Version before the dependency bump. Required unless `list` is set.',
|
|
43
|
+
'Version before the dependency bump. Required unless `list` or `registry` is set.',
|
|
36
44
|
},
|
|
37
45
|
{
|
|
38
46
|
name: 'options.apply',
|
|
@@ -73,6 +81,13 @@ export const doc = {
|
|
|
73
81
|
type: 'boolean',
|
|
74
82
|
description: 'Auto-install jscodeshift without prompting.',
|
|
75
83
|
},
|
|
84
|
+
{
|
|
85
|
+
name: 'options.registry',
|
|
86
|
+
type: 'boolean',
|
|
87
|
+
description:
|
|
88
|
+
'Reconcile copied compositions from their install receipts without requiring `from`.',
|
|
89
|
+
default: 'false',
|
|
90
|
+
},
|
|
76
91
|
{
|
|
77
92
|
name: 'options.list',
|
|
78
93
|
type: 'boolean',
|
|
@@ -90,21 +105,26 @@ export const doc = {
|
|
|
90
105
|
description:
|
|
91
106
|
'Every available codemod, oldest→newest, as {name, title, version, optional}, returned when `list` is set; nothing is run.',
|
|
92
107
|
},
|
|
108
|
+
{
|
|
109
|
+
type: 'upgrade.registry',
|
|
110
|
+
description:
|
|
111
|
+
'A dry-run or apply receipt for copied compositions, including safe updates, clean merges, conflicts, missing files, and invalid receipts.',
|
|
112
|
+
},
|
|
93
113
|
{
|
|
94
114
|
type: 'upgrade.status',
|
|
95
115
|
description:
|
|
96
|
-
'A short-circuit outcome (no codemods executed): `up_to_date` (`from` is at/after the installed target and no `force`), `no_codemods` (none apply to the range), or `config_fixable` (dry-run preview that a pending config codemod would repair an invalid astryx.config). Each carries the agent-docs summary.',
|
|
116
|
+
'A short-circuit outcome (no codemods executed): `up_to_date` (`from` is at/after the installed target and no `force`), `no_codemods` (none apply to the range), or `config_fixable` (dry-run preview that a pending config codemod would repair an invalid astryx.config). Each carries the agent-docs summary and, when found, the copied-composition registry summary.',
|
|
97
117
|
},
|
|
98
118
|
{
|
|
99
119
|
type: 'upgrade.run',
|
|
100
120
|
description:
|
|
101
|
-
'The terminal run receipt: from/to versions, the codemod count, integrations processed, the agent-docs summary, and (apply mode) filesChanged, transformsApplied, and any per-codemod errors.',
|
|
121
|
+
'The terminal run receipt: from/to versions, the codemod count, integrations processed, the agent-docs summary, an optional copied-composition registry summary, and (apply mode) filesChanged, transformsApplied, and any per-codemod errors.',
|
|
102
122
|
},
|
|
103
123
|
],
|
|
104
124
|
throws: [
|
|
105
125
|
{
|
|
106
126
|
code: 'ERR_INVALID_ARGUMENT',
|
|
107
|
-
when: '`from` is missing (and `list` is
|
|
127
|
+
when: '`from` is missing (and neither `list` nor `registry` is set), or the project config fails strict validation and no pending config codemod can repair it',
|
|
108
128
|
},
|
|
109
129
|
{code: 'ERR_INVALID_VERSION', when: '`from` is not a valid semver string'},
|
|
110
130
|
{code: 'ERR_PATH_TRAVERSAL', when: '`path` resolves outside cwd'},
|
|
@@ -131,6 +151,10 @@ export const doc = {
|
|
|
131
151
|
code: 'const r = await upgrade({list: true});',
|
|
132
152
|
},
|
|
133
153
|
{label: 'Preview (dry-run)', code: "await upgrade({from: '0.0.5'});"},
|
|
154
|
+
{
|
|
155
|
+
label: 'Update copied compositions',
|
|
156
|
+
code: 'await upgrade({registry: true, apply: true});',
|
|
157
|
+
},
|
|
134
158
|
{
|
|
135
159
|
label: 'Apply changes',
|
|
136
160
|
code: "await upgrade({from: '0.0.5', apply: true});",
|
package/api/upgrade/upgrade.mjs
CHANGED
|
@@ -4,11 +4,13 @@
|
|
|
4
4
|
* @file upgrade API — dispatcher + barrel over the upgrade leaves.
|
|
5
5
|
*
|
|
6
6
|
* `upgrade(options)` runs codemods that migrate source from a previous Astryx
|
|
7
|
-
* version to the currently installed one,
|
|
8
|
-
* block. It is the single entry the
|
|
9
|
-
* routes to one leaf, each of which
|
|
10
|
-
*
|
|
11
|
-
* - `
|
|
7
|
+
* version to the currently installed one, refreshes the managed agent-docs
|
|
8
|
+
* block, and reconciles ShadCN-copied compositions. It is the single entry the
|
|
9
|
+
* CLI calls; it validates the invocation and routes to one leaf, each of which
|
|
10
|
+
* returns its `{type, data}` envelope:
|
|
11
|
+
* - `list` (api/upgrade/list) → upgrade.list — codemods, no run
|
|
12
|
+
* - `registry` (api/upgrade/registry) → upgrade.registry — copied source only
|
|
13
|
+
* - `run` (api/upgrade/run) → upgrade.run — the terminal run receipt,
|
|
12
14
|
* plus the up_to_date / no_codemods / config_fixable short-circuits it
|
|
13
15
|
* delegates to the `status` leaf → upgrade.status
|
|
14
16
|
*
|
|
@@ -20,6 +22,7 @@
|
|
|
20
22
|
*/
|
|
21
23
|
|
|
22
24
|
import {list} from './list/list.mjs';
|
|
25
|
+
import {registryUpgrade} from './registry/registry.mjs';
|
|
23
26
|
import {run} from './run/run.mjs';
|
|
24
27
|
import {isValidSemver} from '../../foundation/env/semver.mjs';
|
|
25
28
|
import {getCliInvocation} from '../../foundation/env/package-manager.mjs';
|
|
@@ -27,7 +30,6 @@ import {ERROR_CODES} from '../../foundation/response/error-codes.mjs';
|
|
|
27
30
|
import {AstryxError} from '../error.mjs';
|
|
28
31
|
import {logger} from '../logger.mjs';
|
|
29
32
|
|
|
30
|
-
|
|
31
33
|
/**
|
|
32
34
|
* @typedef {import('./upgrade.type.mjs').UpgradeOptions} UpgradeOptions
|
|
33
35
|
*/
|
|
@@ -39,11 +41,36 @@ import {logger} from '../logger.mjs';
|
|
|
39
41
|
*
|
|
40
42
|
* @param {UpgradeOptions} [options]
|
|
41
43
|
* @param {{cwd?: string}} [ctx]
|
|
42
|
-
* @returns {Promise<import('./upgrade.type.mjs').UpgradeListResponse | import('./upgrade.type.mjs').UpgradeStatusResponse | import('./upgrade.type.mjs').UpgradeRunResponse>}
|
|
44
|
+
* @returns {Promise<import('./upgrade.type.mjs').UpgradeListResponse | import('./upgrade.type.mjs').UpgradeRegistryResponse | import('./upgrade.type.mjs').UpgradeStatusResponse | import('./upgrade.type.mjs').UpgradeRunResponse>}
|
|
43
45
|
*/
|
|
44
46
|
export async function upgrade(options = {}, {cwd = process.cwd()} = {}) {
|
|
45
47
|
logger.log('\nUpgrade');
|
|
46
48
|
|
|
49
|
+
if (options.list && options.registry) {
|
|
50
|
+
const msg = '`--list` and `--registry` cannot be used together.';
|
|
51
|
+
logger.error(msg);
|
|
52
|
+
logger.log('Aborted\n');
|
|
53
|
+
throw new AstryxError(msg, undefined, ERROR_CODES.ERR_INVALID_ARGUMENT);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (options.registry) {
|
|
57
|
+
const incompatible = [
|
|
58
|
+
options.from ? '--from' : null,
|
|
59
|
+
options.force ? '--force' : null,
|
|
60
|
+
options.codemod ? '--codemod' : null,
|
|
61
|
+
options.skipCodemod?.length ? '--skip-codemod' : null,
|
|
62
|
+
options.integration?.length ? '--integration' : null,
|
|
63
|
+
options.installDeps ? '--install-deps' : null,
|
|
64
|
+
].filter(Boolean);
|
|
65
|
+
if (incompatible.length > 0) {
|
|
66
|
+
const msg = `\`--registry\` cannot be combined with ${incompatible.join(', ')}.`;
|
|
67
|
+
logger.error(msg);
|
|
68
|
+
logger.log('Aborted\n');
|
|
69
|
+
throw new AstryxError(msg, undefined, ERROR_CODES.ERR_INVALID_ARGUMENT);
|
|
70
|
+
}
|
|
71
|
+
return registryUpgrade(options, {cwd});
|
|
72
|
+
}
|
|
73
|
+
|
|
47
74
|
if (!options.list && !options.from) {
|
|
48
75
|
const msg = `Missing required --from. Install the target version first, then run \`${getCliInvocation()} upgrade --from <old-version>\`.`;
|
|
49
76
|
logger.error(msg);
|