@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
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/** @file CLI bindings for integration authoring and package verification. */
|
|
4
|
+
|
|
5
|
+
import {integrationAdd} from '../../../api/integration/add-contribution.mjs';
|
|
6
|
+
import {integrationPackCheck} from '../../../api/integration/pack-check.mjs';
|
|
7
|
+
import {jsonOut} from '../../../foundation/response/json.mjs';
|
|
8
|
+
import {ERROR_CODES} from '../../../foundation/response/error-codes.mjs';
|
|
9
|
+
import {NO_RESULT_SET} from '../../../foundation/debug/index.mjs';
|
|
10
|
+
import {emit, list, section, text} from '../formatters/index.mjs';
|
|
11
|
+
import {cliError} from '../lib/cli-error.mjs';
|
|
12
|
+
import {defineCommand} from '../lib/define-command.mjs';
|
|
13
|
+
import {doc as integrationGroup} from './integration.doc.mjs';
|
|
14
|
+
import {doc as integrationAddCommand} from './integration-add.doc.mjs';
|
|
15
|
+
import {doc as integrationPackCommand} from './integration-pack.doc.mjs';
|
|
16
|
+
import {doc as integrationAddFn} from '../../../api/integration/integrationAdd.doc.mjs';
|
|
17
|
+
import {doc as integrationPackCheckFn} from '../../../api/integration/integrationPackCheck.doc.mjs';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @param {import('commander').Command} command
|
|
21
|
+
* @param {string} label
|
|
22
|
+
* @param {unknown} options
|
|
23
|
+
* @param {import('commander').Command} invoked
|
|
24
|
+
*/
|
|
25
|
+
function showGroupOrUnknown(command, label, options, invoked) {
|
|
26
|
+
const extras = invoked?.args ?? [];
|
|
27
|
+
if (extras.length > 0) {
|
|
28
|
+
return cliError(`unknown subcommand '${label} ${String(extras[0])}'`, {
|
|
29
|
+
suggestions: (command.commands ?? []).map(child => ({
|
|
30
|
+
name: child.name(),
|
|
31
|
+
reason: 'available subcommand',
|
|
32
|
+
})),
|
|
33
|
+
code: ERROR_CODES.ERR_UNKNOWN_SUBCOMMAND,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
command.outputHelp();
|
|
37
|
+
return NO_RESULT_SET;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** @param {import('commander').Command} program */
|
|
41
|
+
export function registerIntegration(program) {
|
|
42
|
+
/** @type {import('commander').Command} */
|
|
43
|
+
let integration;
|
|
44
|
+
integration = defineCommand(program, integrationGroup, {
|
|
45
|
+
action: (options, command) =>
|
|
46
|
+
showGroupOrUnknown(integration, 'integration', options, command),
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
defineCommand(integration, integrationAddCommand, {
|
|
50
|
+
fn: integrationAddFn,
|
|
51
|
+
action: async (kind, name, options) => {
|
|
52
|
+
const json = program.opts().json || false;
|
|
53
|
+
let result;
|
|
54
|
+
try {
|
|
55
|
+
result = await integrationAdd(kind, name, {
|
|
56
|
+
cwd: process.cwd(),
|
|
57
|
+
dryRun: options.dryRun,
|
|
58
|
+
templateType: options.type,
|
|
59
|
+
replaces: options.replaces,
|
|
60
|
+
extends: options.extends,
|
|
61
|
+
to: options.to,
|
|
62
|
+
});
|
|
63
|
+
} catch (error) {
|
|
64
|
+
const err =
|
|
65
|
+
/** @type {import('../../../api/error.mjs').AstryxError} */ (error);
|
|
66
|
+
return cliError(err.message, {
|
|
67
|
+
suggestions: err.suggestions ?? [],
|
|
68
|
+
code: err.code,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (json) {
|
|
73
|
+
jsonOut(result);
|
|
74
|
+
return NO_RESULT_SET;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const {root, manifest, files, written, dryRun} = result.data;
|
|
78
|
+
const state = dryRun ? 'plan' : written ? 'ok' : 'unchanged';
|
|
79
|
+
const blocks = [
|
|
80
|
+
section(
|
|
81
|
+
dryRun
|
|
82
|
+
? `${kind} contribution plan`
|
|
83
|
+
: written
|
|
84
|
+
? `${kind} contribution added`
|
|
85
|
+
: `${kind} contribution unchanged`,
|
|
86
|
+
),
|
|
87
|
+
text(`[${state}] ${result.data.name}`),
|
|
88
|
+
];
|
|
89
|
+
if (root != null) {
|
|
90
|
+
blocks.push(
|
|
91
|
+
text(
|
|
92
|
+
`${root.created ? 'Declare' : 'Use'} ${kind} root ${root.path} in ${manifest}.`,
|
|
93
|
+
),
|
|
94
|
+
);
|
|
95
|
+
} else {
|
|
96
|
+
blocks.push(text(`Update ${manifest}.`));
|
|
97
|
+
}
|
|
98
|
+
if (files.length > 0) blocks.push(list(files));
|
|
99
|
+
emit(...blocks);
|
|
100
|
+
return NO_RESULT_SET;
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
defineCommand(integration, integrationPackCommand, {
|
|
105
|
+
fn: integrationPackCheckFn,
|
|
106
|
+
action: async options => {
|
|
107
|
+
if (!options.check) {
|
|
108
|
+
return cliError('Pass --check to verify the integration tarball.', {
|
|
109
|
+
code: ERROR_CODES.ERR_INVALID_ARGUMENT,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const result = await integrationPackCheck({cwd: process.cwd()});
|
|
114
|
+
if (program.opts().json) {
|
|
115
|
+
jsonOut(result);
|
|
116
|
+
} else {
|
|
117
|
+
const {name, version, packable, tarball, inventory, issues} =
|
|
118
|
+
result.data;
|
|
119
|
+
const identity = [name, version].filter(Boolean).join('@');
|
|
120
|
+
const blocks = [
|
|
121
|
+
section(
|
|
122
|
+
packable
|
|
123
|
+
? 'Integration package ready'
|
|
124
|
+
: 'Integration package check failed',
|
|
125
|
+
),
|
|
126
|
+
text(
|
|
127
|
+
`${packable ? '[ok]' : '[fail]'} ${identity || 'local package'}`,
|
|
128
|
+
),
|
|
129
|
+
];
|
|
130
|
+
if (tarball != null) {
|
|
131
|
+
blocks.push(
|
|
132
|
+
text(
|
|
133
|
+
`${tarball.fileCount} packed files; ${inventory.packedFiles}/${inventory.expectedFiles} required files present.`,
|
|
134
|
+
),
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
if (issues.length > 0) {
|
|
138
|
+
blocks.push(
|
|
139
|
+
list(
|
|
140
|
+
issues.map(
|
|
141
|
+
issue =>
|
|
142
|
+
`[${issue.severity === 'error' ? 'fail' : 'warn'}] ${issue.message}`,
|
|
143
|
+
),
|
|
144
|
+
),
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
emit(...blocks);
|
|
148
|
+
}
|
|
149
|
+
if (!result.data.packable) process.exitCode = 1;
|
|
150
|
+
return NO_RESULT_SET;
|
|
151
|
+
},
|
|
152
|
+
});
|
|
153
|
+
}
|
|
@@ -16,9 +16,9 @@ export const doc = {
|
|
|
16
16
|
namespace: 'cli',
|
|
17
17
|
summary: 'Scaffold a theme into your project as editable source',
|
|
18
18
|
description:
|
|
19
|
-
"Copies a bundled theme's source into your project so you own it
|
|
20
|
-
'
|
|
21
|
-
'
|
|
19
|
+
"Copies a bundled or installed integration theme's source into your project so you own it. " +
|
|
20
|
+
'Writes are staged then renamed, rolling back on failure. Running it with no slug, or with ' +
|
|
21
|
+
'--list, lists available themes; use --package when more than one owner provides the slug.',
|
|
22
22
|
fn: 'themeAdd',
|
|
23
23
|
args: [
|
|
24
24
|
{name: 'slug', param: 'slug', required: false},
|
|
@@ -31,19 +31,24 @@ export const doc = {
|
|
|
31
31
|
description: 'Overwrite existing files without prompting',
|
|
32
32
|
},
|
|
33
33
|
{flag: '--list', description: 'List available themes'},
|
|
34
|
+
{
|
|
35
|
+
flag: '--package <package>',
|
|
36
|
+
param: 'options.package',
|
|
37
|
+
description: 'Select the package that owns the theme',
|
|
38
|
+
},
|
|
34
39
|
],
|
|
35
40
|
examples: [
|
|
36
41
|
{label: 'Scaffold a theme', cli: 'astryx theme add matcha'},
|
|
37
42
|
{
|
|
38
|
-
label: '
|
|
39
|
-
cli: 'astryx theme add
|
|
43
|
+
label: 'Select an integration theme',
|
|
44
|
+
cli: 'astryx theme add ocean --package @acme/themes',
|
|
40
45
|
},
|
|
41
46
|
],
|
|
42
47
|
exitCodes: [
|
|
43
48
|
{code: 0, when: 'success'},
|
|
44
49
|
{
|
|
45
50
|
code: 1,
|
|
46
|
-
when: 'unknown theme, a path escape, a missing
|
|
51
|
+
when: 'unknown or ambiguous theme, a path escape, a missing catalog file, or an existing file without --overwrite',
|
|
47
52
|
},
|
|
48
53
|
],
|
|
49
54
|
related: ['theme list', 'theme build'],
|
|
@@ -16,13 +16,29 @@ export const doc = {
|
|
|
16
16
|
namespace: 'cli',
|
|
17
17
|
summary: 'List themes available to add',
|
|
18
18
|
description:
|
|
19
|
-
'Lists
|
|
20
|
-
'each with its slug, display name, description, and
|
|
21
|
-
fn: '
|
|
22
|
-
|
|
19
|
+
'Lists themes bundled with this CLI and source themes contributed by installed integrations, ' +
|
|
20
|
+
'each with its slug, display name, description, maintained flag, and owner package.',
|
|
21
|
+
fn: 'themeListAvailable',
|
|
22
|
+
options: [
|
|
23
|
+
{
|
|
24
|
+
flag: '--package <package>',
|
|
25
|
+
param: 'options.package',
|
|
26
|
+
description: 'Show only themes owned by this package',
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
examples: [
|
|
30
|
+
{label: 'List available themes', cli: 'astryx theme list --json'},
|
|
31
|
+
{
|
|
32
|
+
label: 'List one integration package',
|
|
33
|
+
cli: 'astryx theme list --package @acme/themes',
|
|
34
|
+
},
|
|
35
|
+
],
|
|
23
36
|
exitCodes: [
|
|
24
37
|
{code: 0, when: 'success'},
|
|
25
|
-
{
|
|
38
|
+
{
|
|
39
|
+
code: 1,
|
|
40
|
+
when: 'the bundled-theme manifest or an installed theme catalog cannot be read',
|
|
41
|
+
},
|
|
26
42
|
],
|
|
27
43
|
related: ['theme add', 'theme build'],
|
|
28
44
|
};
|
|
@@ -22,18 +22,35 @@ describe('astryx theme targets', () => {
|
|
|
22
22
|
expect(stdout).toMatch(/4 across 1 component/);
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
+
it('labels deprecated targets with their exact canonical replacement', async () => {
|
|
26
|
+
const {status, stdout} = await runCli(['theme', 'targets', 'Popover']);
|
|
27
|
+
|
|
28
|
+
expect(status).toBe(0);
|
|
29
|
+
expect(stdout).toMatch(/^popover\s{2,}Popover/m);
|
|
30
|
+
expect(stdout).toMatch(
|
|
31
|
+
/^popover-surface \[deprecated; use popover\]\s{2,}Popover/m,
|
|
32
|
+
);
|
|
33
|
+
});
|
|
34
|
+
|
|
25
35
|
it('lists the whole surface when unfiltered', async () => {
|
|
26
36
|
const {status, stdout} = await runCli(['theme', 'targets']);
|
|
27
37
|
|
|
28
38
|
expect(status).toBe(0);
|
|
29
|
-
const rows = stdout
|
|
39
|
+
const rows = stdout
|
|
40
|
+
.split('\n')
|
|
41
|
+
.filter(l => /^[a-z][a-z0-9-]*\s{2,}/.test(l));
|
|
30
42
|
expect(rows.length).toBeGreaterThan(100);
|
|
31
43
|
expect(stdout).toMatch(/^button\s/m);
|
|
32
44
|
expect(stdout).toMatch(/^switch-thumb\s/m);
|
|
33
45
|
}, 30_000);
|
|
34
46
|
|
|
35
47
|
it('returns a theme.targets envelope under --json', async () => {
|
|
36
|
-
const {status, stdout} = await runCli([
|
|
48
|
+
const {status, stdout} = await runCli([
|
|
49
|
+
'--json',
|
|
50
|
+
'theme',
|
|
51
|
+
'targets',
|
|
52
|
+
'Switch',
|
|
53
|
+
]);
|
|
37
54
|
|
|
38
55
|
expect(status).toBe(0);
|
|
39
56
|
const payload = JSON.parse(stdout);
|
|
@@ -18,11 +18,11 @@ export const doc = {
|
|
|
18
18
|
'The theme command group. Running astryx theme with no subcommand prints the ' +
|
|
19
19
|
'subcommand list; the work happens in the subcommands: compile a theme (build), ' +
|
|
20
20
|
'scaffold one into your project (add), start a custom one from the annotated template (template), ' +
|
|
21
|
-
'list the bundled themes (list), generate a palette candidate (palette), or list the ' +
|
|
21
|
+
'list the bundled and installed integration themes (list), generate a palette candidate (palette), or list the ' +
|
|
22
22
|
'component theming targets a theme can override (targets).',
|
|
23
23
|
subcommands: ['build', 'add', 'list', 'template', 'palette', 'targets'],
|
|
24
24
|
examples: [
|
|
25
|
-
{label: 'List
|
|
25
|
+
{label: 'List available themes', cli: 'astryx theme list'},
|
|
26
26
|
{label: 'Scaffold a theme', cli: 'astryx theme add matcha'},
|
|
27
27
|
{
|
|
28
28
|
label: 'Generate a palette candidate',
|
|
@@ -13,18 +13,20 @@ export const doc = {
|
|
|
13
13
|
name: 'upgrade',
|
|
14
14
|
displayName: 'astryx upgrade',
|
|
15
15
|
namespace: 'cli',
|
|
16
|
-
summary: '
|
|
16
|
+
summary: 'Migrate versions and update ShadCN-copied compositions',
|
|
17
17
|
description:
|
|
18
18
|
'Migrates project source from a previous Astryx version to the installed one by ' +
|
|
19
19
|
'running the registered codemods, and refreshes the fully rendered managed ' +
|
|
20
20
|
'agent-docs block when Core or configured integration guidance changes. ' +
|
|
21
|
-
'Dry-run by default
|
|
21
|
+
'Dry-run by default. --apply writes codemod and receipt changes, runs hooks, then refreshes agent docs. ' +
|
|
22
|
+
'ShadCN-copied compositions are checked automatically during a normal upgrade, or alone with --registry.',
|
|
22
23
|
fn: 'upgrade',
|
|
23
24
|
options: [
|
|
24
25
|
{
|
|
25
26
|
flag: '--from <version>',
|
|
26
27
|
param: 'options.from',
|
|
27
|
-
description:
|
|
28
|
+
description:
|
|
29
|
+
'Previous version before the dependency upgrade; required unless --list or --registry is set',
|
|
28
30
|
},
|
|
29
31
|
{
|
|
30
32
|
flag: '--apply',
|
|
@@ -69,6 +71,13 @@ export const doc = {
|
|
|
69
71
|
description: 'Auto-install jscodeshift without prompting',
|
|
70
72
|
default: false,
|
|
71
73
|
},
|
|
74
|
+
{
|
|
75
|
+
flag: '--registry',
|
|
76
|
+
param: 'options.registry',
|
|
77
|
+
description:
|
|
78
|
+
'Only reconcile ShadCN-copied compositions; --from is not required',
|
|
79
|
+
default: false,
|
|
80
|
+
},
|
|
72
81
|
{
|
|
73
82
|
flag: '--list',
|
|
74
83
|
param: 'options.list',
|
|
@@ -78,13 +87,17 @@ export const doc = {
|
|
|
78
87
|
],
|
|
79
88
|
examples: [
|
|
80
89
|
{label: 'List available codemods', cli: 'astryx upgrade --list --json'},
|
|
90
|
+
{
|
|
91
|
+
label: 'Update ShadCN-copied compositions',
|
|
92
|
+
cli: 'astryx upgrade --registry --apply',
|
|
93
|
+
},
|
|
81
94
|
{label: 'Apply a migration', cli: 'astryx upgrade --from 0.1.0 --apply'},
|
|
82
95
|
],
|
|
83
96
|
exitCodes: [
|
|
84
97
|
{code: 0, when: 'success (including dry-run previews)'},
|
|
85
98
|
{
|
|
86
99
|
code: 1,
|
|
87
|
-
when: 'missing or invalid --from, a --path escape, an unknown codemod,
|
|
100
|
+
when: 'missing or invalid --from, a --path escape, an unknown codemod, a codemod failure, or unresolved registry items',
|
|
88
101
|
},
|
|
89
102
|
],
|
|
90
103
|
related: ['init', 'doctor'],
|
|
@@ -35,7 +35,7 @@ export function registerUpgrade(program) {
|
|
|
35
35
|
const json = program.opts().json || false;
|
|
36
36
|
logger.setSilent(json);
|
|
37
37
|
|
|
38
|
-
/** @type {import('../../../api/upgrade/upgrade.type.mjs').UpgradeListResponse | import('../../../api/upgrade/upgrade.type.mjs').UpgradeStatusResponse | import('../../../api/upgrade/upgrade.type.mjs').UpgradeRunResponse} */
|
|
38
|
+
/** @type {import('../../../api/upgrade/upgrade.type.mjs').UpgradeListResponse | import('../../../api/upgrade/upgrade.type.mjs').UpgradeRegistryResponse | import('../../../api/upgrade/upgrade.type.mjs').UpgradeStatusResponse | import('../../../api/upgrade/upgrade.type.mjs').UpgradeRunResponse} */
|
|
39
39
|
let result;
|
|
40
40
|
try {
|
|
41
41
|
result = await upgradeApi(options, {cwd: process.cwd()});
|
|
@@ -55,6 +55,17 @@ export function registerUpgrade(program) {
|
|
|
55
55
|
|
|
56
56
|
if (json) jsonOut(result);
|
|
57
57
|
|
|
58
|
+
const registrySummary =
|
|
59
|
+
result.type === 'upgrade.registry'
|
|
60
|
+
? result.data
|
|
61
|
+
: result.type === 'upgrade.run'
|
|
62
|
+
? result.data.registryCompositions
|
|
63
|
+
: result.type === 'upgrade.status' &&
|
|
64
|
+
'registryCompositions' in result.data
|
|
65
|
+
? result.data.registryCompositions
|
|
66
|
+
: undefined;
|
|
67
|
+
if (registrySummary && !registrySummary.ok) process.exitCode = 1;
|
|
68
|
+
|
|
58
69
|
// `--list` is the one lookup here: which migrations exist for the
|
|
59
70
|
// range. Everything else migrates the project — an effect, reported by
|
|
60
71
|
// the receipt rather than counted.
|
|
@@ -16,6 +16,7 @@ let originalCwd;
|
|
|
16
16
|
let logCalls;
|
|
17
17
|
let stdoutCalls;
|
|
18
18
|
let exitCode;
|
|
19
|
+
let previousProcessExitCode;
|
|
19
20
|
|
|
20
21
|
beforeEach(() => {
|
|
21
22
|
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-upgrade-test-'));
|
|
@@ -24,6 +25,8 @@ beforeEach(() => {
|
|
|
24
25
|
logCalls = [];
|
|
25
26
|
stdoutCalls = [];
|
|
26
27
|
exitCode = undefined;
|
|
28
|
+
previousProcessExitCode = process.exitCode;
|
|
29
|
+
process.exitCode = undefined;
|
|
27
30
|
vi.spyOn(console, 'log').mockImplementation((...args) => {
|
|
28
31
|
logCalls.push(args.join(' '));
|
|
29
32
|
});
|
|
@@ -43,6 +46,7 @@ beforeEach(() => {
|
|
|
43
46
|
afterEach(() => {
|
|
44
47
|
process.chdir(originalCwd);
|
|
45
48
|
fs.rmSync(tmpDir, {recursive: true, force: true});
|
|
49
|
+
process.exitCode = previousProcessExitCode;
|
|
46
50
|
vi.restoreAllMocks();
|
|
47
51
|
});
|
|
48
52
|
|
|
@@ -133,6 +137,43 @@ describe('upgrade argument validation', () => {
|
|
|
133
137
|
expect(exitCode).toBe(1);
|
|
134
138
|
});
|
|
135
139
|
|
|
140
|
+
it('allows receipt-only upgrades without --from', async () => {
|
|
141
|
+
writeSourceFile();
|
|
142
|
+
const result = await runJson([
|
|
143
|
+
'--json',
|
|
144
|
+
'upgrade',
|
|
145
|
+
'--registry',
|
|
146
|
+
'--path',
|
|
147
|
+
'src',
|
|
148
|
+
]);
|
|
149
|
+
|
|
150
|
+
expect(result).toMatchObject({
|
|
151
|
+
type: 'upgrade.registry',
|
|
152
|
+
data: {found: 0, applied: false},
|
|
153
|
+
});
|
|
154
|
+
expect(exitCode).toBeUndefined();
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
it('exits 1 while preserving the receipt for unresolved registry items', async () => {
|
|
158
|
+
writeInstalledCore('0.6.0');
|
|
159
|
+
fs.mkdirSync(path.join(tmpDir, 'src', '.astryx'), {recursive: true});
|
|
160
|
+
fs.writeFileSync(path.join(tmpDir, 'src', '.astryx', 'broken.json'), '{}');
|
|
161
|
+
|
|
162
|
+
const result = await runJson([
|
|
163
|
+
'--json',
|
|
164
|
+
'upgrade',
|
|
165
|
+
'--registry',
|
|
166
|
+
'--path',
|
|
167
|
+
'src',
|
|
168
|
+
]);
|
|
169
|
+
|
|
170
|
+
expect(result).toMatchObject({
|
|
171
|
+
type: 'upgrade.registry',
|
|
172
|
+
data: {ok: false, invalid: 1},
|
|
173
|
+
});
|
|
174
|
+
expect(process.exitCode).toBe(1);
|
|
175
|
+
});
|
|
176
|
+
|
|
136
177
|
it('rejects bogus --from values', async () => {
|
|
137
178
|
writePkg();
|
|
138
179
|
writeInstalledCore('0.0.15');
|
package/clients/cli/index.mjs
CHANGED
|
@@ -85,6 +85,7 @@ export const JSON_SUPPORTED = new Set([
|
|
|
85
85
|
'search',
|
|
86
86
|
'build',
|
|
87
87
|
'swizzle',
|
|
88
|
+
'gap-report',
|
|
88
89
|
'template',
|
|
89
90
|
'hook',
|
|
90
91
|
'theme build',
|
|
@@ -93,6 +94,8 @@ export const JSON_SUPPORTED = new Set([
|
|
|
93
94
|
'theme template',
|
|
94
95
|
'theme targets',
|
|
95
96
|
'theme palette generate',
|
|
97
|
+
'integration add',
|
|
98
|
+
'integration pack',
|
|
96
99
|
'upgrade',
|
|
97
100
|
'manifest',
|
|
98
101
|
'doctor',
|
|
@@ -258,11 +261,13 @@ const commands = [
|
|
|
258
261
|
{name: 'docs', path: './commands/docs.mjs', register: 'registerDocs'},
|
|
259
262
|
{name: 'blog', path: './commands/blog.mjs', register: 'registerBlog'},
|
|
260
263
|
{name: 'swizzle', path: './commands/swizzle.mjs', register: 'registerSwizzle'},
|
|
264
|
+
{name: 'gap-report', path: './commands/gap-report.mjs', register: 'registerGapReport'},
|
|
261
265
|
// agent-docs folded into init — functions still importable from agent-docs.mjs
|
|
262
266
|
{name: 'template', path: './commands/template.mjs', register: 'registerTemplate'},
|
|
263
267
|
{name: 'layout', path: './commands/layout.mjs', register: 'registerLayout'},
|
|
264
268
|
{name: 'upgrade', path: './commands/upgrade.mjs', register: 'registerUpgrade'},
|
|
265
269
|
{name: 'theme', path: './commands/build-theme.mjs', register: 'registerTheme'},
|
|
270
|
+
{name: 'integration', path: './commands/integration.mjs', register: 'registerIntegration'},
|
|
266
271
|
{name: 'hook', path: './commands/hook/index.mjs', register: 'registerHook'},
|
|
267
272
|
{name: 'discover', path: './commands/discover.mjs', register: 'registerDiscover'},
|
|
268
273
|
{name: 'search', path: './commands/search.mjs', register: 'registerSearch'},
|
|
@@ -26,6 +26,15 @@ function targetKey(target) {
|
|
|
26
26
|
return target.className.replace(/^astryx-/, '');
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Keep deprecated targets visible in reference tables while excluding them from
|
|
31
|
+
* snippets readers copy into newly authored themes.
|
|
32
|
+
* @param {import('@astryxdesign/cli/authoring').ComponentThemingTarget[]} targets
|
|
33
|
+
*/
|
|
34
|
+
function canonicalTargets(targets) {
|
|
35
|
+
return targets.filter(target => target.deprecatedFor == null);
|
|
36
|
+
}
|
|
37
|
+
|
|
29
38
|
/** @param {string} name @returns {string} */
|
|
30
39
|
function dataAttrForName(name) {
|
|
31
40
|
return `data-${name.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase()}`;
|
|
@@ -187,8 +196,11 @@ function formatTargetsTable(docs, themeData) {
|
|
|
187
196
|
const dataAttrsStr =
|
|
188
197
|
dataAttrs.length > 0 ? dataAttrs.map(attr => `\`${attr}\``).join(', ') : '—';
|
|
189
198
|
|
|
199
|
+
const className = target.deprecatedFor
|
|
200
|
+
? `\`${target.className}\` _(deprecated; use \`${target.deprecatedFor}\`)_`
|
|
201
|
+
: `\`${target.className}\``;
|
|
190
202
|
lines.push(
|
|
191
|
-
`|
|
|
203
|
+
`| ${className} | ${dataAttrsStr} | ${variantsStr} | ${statesStr} |`,
|
|
192
204
|
);
|
|
193
205
|
}
|
|
194
206
|
|
|
@@ -287,35 +299,37 @@ export function formatFull(docs, options = {}) {
|
|
|
287
299
|
}
|
|
288
300
|
}
|
|
289
301
|
|
|
290
|
-
// Generate defineTheme example with component
|
|
291
|
-
const
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
const firstVariant = rootTarget.visualProps[0];
|
|
298
|
-
exampleLines.push(` '${firstVariant}:value': { /* variant-specific */ },`);
|
|
299
|
-
}
|
|
300
|
-
if (rootTarget.states?.length) {
|
|
301
|
-
const firstState = rootTarget.states[0];
|
|
302
|
-
exampleLines.push(` '${firstState}': { /* state-specific */ },`);
|
|
303
|
-
}
|
|
304
|
-
exampleLines.push(` },`);
|
|
305
|
-
// Show sub-element example if there are multiple targets
|
|
306
|
-
if (docs.theming.targets.length > 1) {
|
|
307
|
-
const subTarget = docs.theming.targets[1];
|
|
308
|
-
const subKey = targetKey(subTarget);
|
|
309
|
-
exampleLines.push(` '${subKey}': {`);
|
|
302
|
+
// Generate defineTheme example with canonical component selectors only.
|
|
303
|
+
const exampleTargets = canonicalTargets(docs.theming.targets);
|
|
304
|
+
if (exampleTargets.length > 0) {
|
|
305
|
+
const exampleLines = ['Override in defineTheme:\n```ts\ncomponents: {'];
|
|
306
|
+
const rootTarget = exampleTargets[0];
|
|
307
|
+
const rootKey = targetKey(rootTarget);
|
|
308
|
+
exampleLines.push(` '${rootKey}': {`);
|
|
310
309
|
exampleLines.push(` base: { /* CSS properties */ },`);
|
|
311
|
-
if (
|
|
312
|
-
const
|
|
310
|
+
if (rootTarget.visualProps?.length) {
|
|
311
|
+
const firstVariant = rootTarget.visualProps[0];
|
|
312
|
+
exampleLines.push(` '${firstVariant}:value': { /* variant-specific */ },`);
|
|
313
|
+
}
|
|
314
|
+
if (rootTarget.states?.length) {
|
|
315
|
+
const firstState = rootTarget.states[0];
|
|
313
316
|
exampleLines.push(` '${firstState}': { /* state-specific */ },`);
|
|
314
317
|
}
|
|
315
318
|
exampleLines.push(` },`);
|
|
319
|
+
if (exampleTargets.length > 1) {
|
|
320
|
+
const subTarget = exampleTargets[1];
|
|
321
|
+
const subKey = targetKey(subTarget);
|
|
322
|
+
exampleLines.push(` '${subKey}': {`);
|
|
323
|
+
exampleLines.push(` base: { /* CSS properties */ },`);
|
|
324
|
+
if (subTarget.states?.length) {
|
|
325
|
+
const firstState = subTarget.states[0];
|
|
326
|
+
exampleLines.push(` '${firstState}': { /* state-specific */ },`);
|
|
327
|
+
}
|
|
328
|
+
exampleLines.push(` },`);
|
|
329
|
+
}
|
|
330
|
+
exampleLines.push('}\n```\n');
|
|
331
|
+
sections.push(exampleLines.join('\n'));
|
|
316
332
|
}
|
|
317
|
-
exampleLines.push('}\n```\n');
|
|
318
|
-
sections.push(exampleLines.join('\n'));
|
|
319
333
|
}
|
|
320
334
|
|
|
321
335
|
// Legacy componentKey (for backward compatibility)
|
|
@@ -342,7 +356,8 @@ export function formatFull(docs, options = {}) {
|
|
|
342
356
|
|
|
343
357
|
// Show derived property examples — the recommended way to theme
|
|
344
358
|
if (docs.theming?.derived?.length) {
|
|
345
|
-
const
|
|
359
|
+
const canonical = canonicalTargets(docs.theming.targets || []);
|
|
360
|
+
const varsKey = canonical.length ? targetKey(canonical[0]) : docs.theming.componentKey || '';
|
|
346
361
|
const derivedExamples = docs.theming.derived
|
|
347
362
|
.filter((/** @type {any} */ d) => d.vars?.length)
|
|
348
363
|
.map((/** @type {any} */ d) => ` ${d.property}: '...',`)
|
|
@@ -564,6 +579,7 @@ export function formatBrief(docs, componentName, importHint, options = {}) {
|
|
|
564
579
|
const { themeData = null } = options;
|
|
565
580
|
const targetParts = docs.theming.targets.map((/** @type {any} */ t) => {
|
|
566
581
|
const parts = [t.className];
|
|
582
|
+
if (t.deprecatedFor) parts.push(`deprecated→${t.deprecatedFor}`);
|
|
567
583
|
const dataAttrs = getTargetDataAttributes(t);
|
|
568
584
|
if (dataAttrs.length) parts.push(`preferred attrs: ${dataAttrs.join(', ')}`);
|
|
569
585
|
if (t.visualProps?.length) parts.push(`variants: ${t.visualProps.join(', ')}`);
|
|
@@ -115,7 +115,7 @@ describe('formatFull theming override keys', () => {
|
|
|
115
115
|
description: 'A table.',
|
|
116
116
|
theming: {
|
|
117
117
|
targets: [
|
|
118
|
-
{className: 'astryx-
|
|
118
|
+
{className: 'astryx-table-header'},
|
|
119
119
|
{className: 'astryx-table-cell'},
|
|
120
120
|
],
|
|
121
121
|
},
|
|
@@ -123,14 +123,45 @@ describe('formatFull theming override keys', () => {
|
|
|
123
123
|
const out = formatFull(docs);
|
|
124
124
|
|
|
125
125
|
// Correct keys: class name minus the astryx- prefix.
|
|
126
|
-
expect(out).toContain("'
|
|
126
|
+
expect(out).toContain("'table-header': {");
|
|
127
127
|
expect(out).toContain("'table-cell': {");
|
|
128
128
|
// The verbatim DOM class names must not be advertised as override keys.
|
|
129
|
-
expect(out).not.toContain("'astryx-
|
|
129
|
+
expect(out).not.toContain("'astryx-table-header': {");
|
|
130
130
|
expect(out).not.toContain("'astryx-table-cell': {");
|
|
131
131
|
});
|
|
132
132
|
});
|
|
133
133
|
|
|
134
|
+
describe('deprecated theming target guidance', () => {
|
|
135
|
+
const docs = {
|
|
136
|
+
name: 'Example',
|
|
137
|
+
description: 'An example.',
|
|
138
|
+
theming: {
|
|
139
|
+
targets: [
|
|
140
|
+
{className: 'astryx-old-target', deprecatedFor: 'new-target'},
|
|
141
|
+
{className: 'astryx-new-target'},
|
|
142
|
+
],
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
it('names the canonical replacement in full component docs', () => {
|
|
147
|
+
expect(formatFull(docs)).toContain(
|
|
148
|
+
'`astryx-old-target` _(deprecated; use `new-target`)_',
|
|
149
|
+
);
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
it('excludes deprecated targets from copyable defineTheme examples', () => {
|
|
153
|
+
const out = formatFull(docs);
|
|
154
|
+
expect(out).not.toContain("'old-target': {");
|
|
155
|
+
expect(out).toContain("'new-target': {");
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
it('keeps the replacement in brief agent guidance', () => {
|
|
159
|
+
expect(formatBrief(docs, 'Example')).toContain(
|
|
160
|
+
'astryx-old-target deprecated→new-target',
|
|
161
|
+
);
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
|
|
134
165
|
/** Pipes that actually separate cells — a `\|` is content, not a separator. */
|
|
135
166
|
function cellPipes(row) {
|
|
136
167
|
return (row.match(/(?<!\\)\|/g) || []).length;
|