@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
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
|
|
34
34
|
import * as fs from 'node:fs';
|
|
35
35
|
import * as path from 'node:path';
|
|
36
|
+
import jscodeshift from 'jscodeshift';
|
|
36
37
|
import {assertWithin} from '../../foundation/fs/path-safety.mjs';
|
|
37
38
|
import {
|
|
38
39
|
findManifestPaths,
|
|
@@ -44,6 +45,7 @@ import {
|
|
|
44
45
|
import {
|
|
45
46
|
validateLoadedIntegration,
|
|
46
47
|
issueError as error,
|
|
48
|
+
issueWarning as warning,
|
|
47
49
|
} from '../../foundation/integrations/validate-contributions.mjs';
|
|
48
50
|
|
|
49
51
|
export {validateLoadedIntegration};
|
|
@@ -78,14 +80,200 @@ function findNearestPackageJson(cwd) {
|
|
|
78
80
|
}
|
|
79
81
|
}
|
|
80
82
|
|
|
83
|
+
const UNREACHABLE_SCAN_LIMIT = 5_000;
|
|
84
|
+
const UNREACHABLE_SKIP_DIRS = new Set([
|
|
85
|
+
'node_modules',
|
|
86
|
+
'.git',
|
|
87
|
+
'dist',
|
|
88
|
+
'build',
|
|
89
|
+
'coverage',
|
|
90
|
+
'.next',
|
|
91
|
+
'out',
|
|
92
|
+
]);
|
|
93
|
+
const DOC_CANDIDATE_RE = /\.doc\.(?:ts|mjs|js)$/u;
|
|
94
|
+
const TEMPLATE_CANDIDATE_RE = /\.template\.(?:ts|mjs|js)$/u;
|
|
95
|
+
const STATIC_DOC_TYPES = new Set(['component', 'generic', 'page', 'block']);
|
|
96
|
+
const STATIC_TEMPLATE_TYPES = new Set(['page', 'block']);
|
|
97
|
+
const j = jscodeshift.withParser('tsx');
|
|
98
|
+
|
|
99
|
+
/** @param {any} node @returns {any} */
|
|
100
|
+
function unwrapStaticExpression(node) {
|
|
101
|
+
let current = node;
|
|
102
|
+
while (
|
|
103
|
+
current &&
|
|
104
|
+
[
|
|
105
|
+
'TSSatisfiesExpression',
|
|
106
|
+
'TSAsExpression',
|
|
107
|
+
'TypeCastExpression',
|
|
108
|
+
'ParenthesizedExpression',
|
|
109
|
+
].includes(current.type)
|
|
110
|
+
) {
|
|
111
|
+
current = current.expression;
|
|
112
|
+
}
|
|
113
|
+
if (current?.type === 'CallExpression' && current.arguments.length > 0) {
|
|
114
|
+
current = unwrapStaticExpression(current.arguments[0]);
|
|
115
|
+
}
|
|
116
|
+
return current;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** @param {any} property @param {string} name */
|
|
120
|
+
function staticPropertyNamed(property, name) {
|
|
121
|
+
if (
|
|
122
|
+
!property ||
|
|
123
|
+
!['ObjectProperty', 'Property'].includes(property.type) ||
|
|
124
|
+
property.computed
|
|
125
|
+
) {
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
return (
|
|
129
|
+
(property.key?.type === 'Identifier' && property.key.name === name) ||
|
|
130
|
+
(['Literal', 'StringLiteral'].includes(property.key?.type) &&
|
|
131
|
+
property.key.value === name)
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Identify contribution metadata without importing it. Doctor scans files that
|
|
137
|
+
* the manifest does not declare, so executing those files would run code the
|
|
138
|
+
* package never asked Astryx to load.
|
|
139
|
+
*
|
|
140
|
+
* @param {string} file
|
|
141
|
+
* @param {boolean} templateOnly
|
|
142
|
+
*/
|
|
143
|
+
function isStaticContributionMetadata(file, templateOnly) {
|
|
144
|
+
let ast;
|
|
145
|
+
try {
|
|
146
|
+
ast = j(fs.readFileSync(file, 'utf-8'));
|
|
147
|
+
} catch {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
/** @type {any[]} */
|
|
151
|
+
const candidates = [];
|
|
152
|
+
ast
|
|
153
|
+
.find(j.ExportDefaultDeclaration)
|
|
154
|
+
.forEach((/** @type {any} */ exportPath) => {
|
|
155
|
+
candidates.push(exportPath.value.declaration);
|
|
156
|
+
});
|
|
157
|
+
ast
|
|
158
|
+
.find(j.ExportNamedDeclaration)
|
|
159
|
+
.forEach((/** @type {any} */ exportPath) => {
|
|
160
|
+
const declaration = exportPath.value.declaration;
|
|
161
|
+
if (declaration?.type !== 'VariableDeclaration') return;
|
|
162
|
+
for (const declarator of declaration.declarations) {
|
|
163
|
+
if (
|
|
164
|
+
declarator.id?.type === 'Identifier' &&
|
|
165
|
+
declarator.id.name === 'docs'
|
|
166
|
+
) {
|
|
167
|
+
candidates.push(declarator.init);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
const allowedTypes = templateOnly ? STATIC_TEMPLATE_TYPES : STATIC_DOC_TYPES;
|
|
173
|
+
for (const candidate of candidates) {
|
|
174
|
+
const object = unwrapStaticExpression(candidate);
|
|
175
|
+
if (object?.type !== 'ObjectExpression') continue;
|
|
176
|
+
const typeProperty = object.properties.find((/** @type {any} */ property) =>
|
|
177
|
+
staticPropertyNamed(property, 'type'),
|
|
178
|
+
);
|
|
179
|
+
const value = unwrapStaticExpression(typeProperty?.value);
|
|
180
|
+
if (
|
|
181
|
+
['Literal', 'StringLiteral'].includes(value?.type) &&
|
|
182
|
+
allowedTypes.has(value.value)
|
|
183
|
+
) {
|
|
184
|
+
return true;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/** @param {string} candidate @param {string} root */
|
|
191
|
+
function pathIsInside(candidate, root) {
|
|
192
|
+
return candidate === root || candidate.startsWith(`${root}${path.sep}`);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Find real contribution metadata that sits outside every declared root. The
|
|
197
|
+
* scan is local-authoring-only, skips dependency/build output, never follows
|
|
198
|
+
* symlinks, and parses candidates before reporting them so ordinary JS files do
|
|
199
|
+
* not become noise.
|
|
200
|
+
*
|
|
201
|
+
* @param {string} packageDir
|
|
202
|
+
* @param {import('../../foundation/integrations/integrations.mjs').LoadedIntegration} loaded
|
|
203
|
+
* @returns {Promise<Issue[]>}
|
|
204
|
+
*/
|
|
205
|
+
async function findUnreachableContributionIssues(packageDir, loaded) {
|
|
206
|
+
const roots = /** @type {string[]} */ (
|
|
207
|
+
[
|
|
208
|
+
loaded.components,
|
|
209
|
+
loaded.templates,
|
|
210
|
+
loaded.codemods,
|
|
211
|
+
loaded.docs,
|
|
212
|
+
loaded.themes,
|
|
213
|
+
].filter(Boolean)
|
|
214
|
+
);
|
|
215
|
+
/** @type {Issue[]} */
|
|
216
|
+
const issues = [];
|
|
217
|
+
let scanned = 0;
|
|
218
|
+
let truncated = false;
|
|
219
|
+
|
|
220
|
+
/** @param {string} dir */
|
|
221
|
+
async function walk(dir) {
|
|
222
|
+
if (roots.some(root => pathIsInside(dir, root))) return;
|
|
223
|
+
const entries = fs
|
|
224
|
+
.readdirSync(dir, {withFileTypes: true})
|
|
225
|
+
.sort((a, b) => a.name.localeCompare(b.name));
|
|
226
|
+
for (const entry of entries) {
|
|
227
|
+
if (truncated) return;
|
|
228
|
+
if (UNREACHABLE_SKIP_DIRS.has(entry.name)) continue;
|
|
229
|
+
const full = path.join(dir, entry.name);
|
|
230
|
+
if (entry.isDirectory()) {
|
|
231
|
+
await walk(full);
|
|
232
|
+
continue;
|
|
233
|
+
}
|
|
234
|
+
if (!entry.isFile()) continue;
|
|
235
|
+
scanned += 1;
|
|
236
|
+
if (scanned > UNREACHABLE_SCAN_LIMIT) {
|
|
237
|
+
truncated = true;
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
const isTemplate = TEMPLATE_CANDIDATE_RE.test(entry.name);
|
|
241
|
+
if (!isTemplate && !DOC_CANDIDATE_RE.test(entry.name)) continue;
|
|
242
|
+
if (!isStaticContributionMetadata(full, isTemplate)) continue;
|
|
243
|
+
issues.push(
|
|
244
|
+
warning(
|
|
245
|
+
'unreachable_contribution',
|
|
246
|
+
`Found contribution metadata "${path.relative(packageDir, full)}" outside every declared integration root, so it contributes nothing. Move it under the matching root or update the manifest root.`,
|
|
247
|
+
),
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
await walk(packageDir);
|
|
253
|
+
if (truncated) {
|
|
254
|
+
issues.push(
|
|
255
|
+
warning(
|
|
256
|
+
'unreachable_scan_truncated',
|
|
257
|
+
`Stopped unreachable-contribution scanning after ${UNREACHABLE_SCAN_LIMIT} files. Narrow the package or move generated output under dist/build.`,
|
|
258
|
+
),
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
return issues;
|
|
262
|
+
}
|
|
263
|
+
|
|
81
264
|
/**
|
|
82
265
|
* Validate a single integration given its package directory and identity.
|
|
83
266
|
* Shared core for the local and installed entry points.
|
|
84
267
|
* @param {string} packageDir
|
|
85
268
|
* @param {{name: string, version?: string}} identity
|
|
269
|
+
* @param {{scanUnreachable?: boolean}} [options]
|
|
86
270
|
* @returns {Promise<ValidateResult>}
|
|
87
271
|
*/
|
|
88
|
-
async function validateAtPackageDir(
|
|
272
|
+
async function validateAtPackageDir(
|
|
273
|
+
packageDir,
|
|
274
|
+
identity,
|
|
275
|
+
{scanUnreachable = false} = {},
|
|
276
|
+
) {
|
|
89
277
|
/** @type {Issue[]} */
|
|
90
278
|
const issues = [];
|
|
91
279
|
/** @type {ValidateResult} */
|
|
@@ -164,6 +352,7 @@ async function validateAtPackageDir(packageDir, identity) {
|
|
|
164
352
|
templates: resolveRoot(manifest.templates),
|
|
165
353
|
codemods: resolveRoot(manifest.codemods),
|
|
166
354
|
docs: resolveRoot(manifest.docs),
|
|
355
|
+
themes: resolveRoot(manifest.themes),
|
|
167
356
|
issuesUrl: manifest.issuesUrl,
|
|
168
357
|
agentDocs: manifest.agentDocs,
|
|
169
358
|
__agentDocsError: agentDocsError,
|
|
@@ -177,6 +366,11 @@ async function validateAtPackageDir(packageDir, identity) {
|
|
|
177
366
|
// Roots + contribution checks are shared with validateLoadedIntegration so
|
|
178
367
|
// the everyday-command nudge runs the exact same validators.
|
|
179
368
|
issues.push(...(await validateLoadedIntegration(loaded)));
|
|
369
|
+
if (scanUnreachable) {
|
|
370
|
+
issues.push(
|
|
371
|
+
...(await findUnreachableContributionIssues(packageDir, loaded)),
|
|
372
|
+
);
|
|
373
|
+
}
|
|
180
374
|
|
|
181
375
|
return result;
|
|
182
376
|
}
|
|
@@ -202,17 +396,30 @@ export async function validateLocalIntegration(cwd = process.cwd()) {
|
|
|
202
396
|
}
|
|
203
397
|
|
|
204
398
|
/** @type {{name?: string, version?: string}} */
|
|
205
|
-
let pkg
|
|
399
|
+
let pkg;
|
|
206
400
|
try {
|
|
207
401
|
pkg = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf-8'));
|
|
208
|
-
} catch {
|
|
209
|
-
|
|
402
|
+
} catch (err) {
|
|
403
|
+
return {
|
|
404
|
+
found: true,
|
|
405
|
+
manifestFile: manifests[0],
|
|
406
|
+
issues: [
|
|
407
|
+
error(
|
|
408
|
+
'invalid_package_json',
|
|
409
|
+
`Could not parse ${pkgJsonPath}: ${err instanceof Error ? err.message : String(err)}`,
|
|
410
|
+
),
|
|
411
|
+
],
|
|
412
|
+
};
|
|
210
413
|
}
|
|
211
414
|
|
|
212
|
-
return validateAtPackageDir(
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
415
|
+
return validateAtPackageDir(
|
|
416
|
+
packageDir,
|
|
417
|
+
{
|
|
418
|
+
name: pkg.name ?? '(local package)',
|
|
419
|
+
version: pkg.version,
|
|
420
|
+
},
|
|
421
|
+
{scanUnreachable: true},
|
|
422
|
+
);
|
|
216
423
|
}
|
|
217
424
|
|
|
218
425
|
/**
|
|
@@ -244,15 +451,18 @@ export async function validateInstalledIntegration(spec, cwd = process.cwd()) {
|
|
|
244
451
|
let pkg;
|
|
245
452
|
try {
|
|
246
453
|
pkg = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf-8'));
|
|
247
|
-
} catch {
|
|
454
|
+
} catch (err) {
|
|
455
|
+
const exists = fs.existsSync(pkgJsonPath);
|
|
248
456
|
return {
|
|
249
457
|
found: true,
|
|
250
458
|
name: spec,
|
|
251
459
|
version: undefined,
|
|
252
460
|
issues: [
|
|
253
461
|
error(
|
|
254
|
-
'package_not_found',
|
|
255
|
-
|
|
462
|
+
exists ? 'invalid_package_json' : 'package_not_found',
|
|
463
|
+
exists
|
|
464
|
+
? `Could not parse ${pkgJsonPath}: ${err instanceof Error ? err.message : String(err)}`
|
|
465
|
+
: `Could not find installed integration package "${spec}" at ${pkgJsonPath}. Install it first.`,
|
|
256
466
|
),
|
|
257
467
|
],
|
|
258
468
|
};
|
|
@@ -33,13 +33,19 @@ afterEach(() => {
|
|
|
33
33
|
* @param {string} dir
|
|
34
34
|
* @param {{name?: string, version?: string, manifest: string, manifestExt?: string}} opts
|
|
35
35
|
*/
|
|
36
|
-
function writePackage(
|
|
36
|
+
function writePackage(
|
|
37
|
+
dir,
|
|
38
|
+
{name = '@acme/widgets', version = '1.0.0', manifest, manifestExt = 'mjs'},
|
|
39
|
+
) {
|
|
37
40
|
fs.mkdirSync(dir, {recursive: true});
|
|
38
41
|
fs.writeFileSync(
|
|
39
42
|
path.join(dir, 'package.json'),
|
|
40
43
|
JSON.stringify({name, version}),
|
|
41
44
|
);
|
|
42
|
-
fs.writeFileSync(
|
|
45
|
+
fs.writeFileSync(
|
|
46
|
+
path.join(dir, `astryx.integration.${manifestExt}`),
|
|
47
|
+
manifest,
|
|
48
|
+
);
|
|
43
49
|
}
|
|
44
50
|
|
|
45
51
|
/** Find issues by code. */
|
|
@@ -116,7 +122,10 @@ describe('validate-integration API', () => {
|
|
|
116
122
|
it('flags multiple manifests as multiple_manifests error', async () => {
|
|
117
123
|
const pkgDir = path.join(tmpDir, 'pkg');
|
|
118
124
|
writePackage(pkgDir, {manifest: `export default {};\n`});
|
|
119
|
-
fs.writeFileSync(
|
|
125
|
+
fs.writeFileSync(
|
|
126
|
+
path.join(pkgDir, 'astryx.integration.js'),
|
|
127
|
+
'export default {};\n',
|
|
128
|
+
);
|
|
120
129
|
const result = await validateLocalIntegration(pkgDir);
|
|
121
130
|
expect(byCode(result.issues, 'multiple_manifests')).toHaveLength(1);
|
|
122
131
|
});
|
|
@@ -169,7 +178,10 @@ describe('validate-integration API', () => {
|
|
|
169
178
|
const cmDir = path.join(pkgDir, 'codemods', '0.2.0');
|
|
170
179
|
fs.mkdirSync(cmDir, {recursive: true});
|
|
171
180
|
// Missing default export → discovery throws → invalid_codemod.
|
|
172
|
-
fs.writeFileSync(
|
|
181
|
+
fs.writeFileSync(
|
|
182
|
+
path.join(cmDir, 'broken.mjs'),
|
|
183
|
+
`export const nope = 1;\n`,
|
|
184
|
+
);
|
|
173
185
|
|
|
174
186
|
const result = await validateLocalIntegration(pkgDir);
|
|
175
187
|
expect(byCode(result.issues, 'invalid_codemod')).toHaveLength(1);
|
|
@@ -192,6 +204,157 @@ describe('validate-integration API', () => {
|
|
|
192
204
|
expect(byCode(result.issues, 'invalid_template')).toHaveLength(1);
|
|
193
205
|
});
|
|
194
206
|
|
|
207
|
+
it('reports no errors for a valid source-theme catalog', async () => {
|
|
208
|
+
const pkgDir = path.join(tmpDir, 'pkg');
|
|
209
|
+
writePackage(pkgDir, {
|
|
210
|
+
manifest: `export default { themes: './themes' };\n`,
|
|
211
|
+
});
|
|
212
|
+
const themeDir = path.join(pkgDir, 'themes', 'ocean');
|
|
213
|
+
fs.mkdirSync(themeDir, {recursive: true});
|
|
214
|
+
fs.writeFileSync(
|
|
215
|
+
path.join(pkgDir, 'themes', 'manifest.json'),
|
|
216
|
+
JSON.stringify({
|
|
217
|
+
version: 1,
|
|
218
|
+
themes: [
|
|
219
|
+
{
|
|
220
|
+
slug: 'ocean',
|
|
221
|
+
displayName: 'Ocean',
|
|
222
|
+
description: 'Blue and calm.',
|
|
223
|
+
maintained: true,
|
|
224
|
+
entry: 'oceanTheme.ts',
|
|
225
|
+
exportName: 'oceanTheme',
|
|
226
|
+
files: ['oceanTheme.ts'],
|
|
227
|
+
},
|
|
228
|
+
],
|
|
229
|
+
}),
|
|
230
|
+
);
|
|
231
|
+
fs.writeFileSync(
|
|
232
|
+
path.join(themeDir, 'oceanTheme.ts'),
|
|
233
|
+
`export const oceanTheme = {};\n`,
|
|
234
|
+
);
|
|
235
|
+
|
|
236
|
+
const result = await validateLocalIntegration(pkgDir);
|
|
237
|
+
expect(byCode(result.issues, 'invalid_theme')).toHaveLength(0);
|
|
238
|
+
expect(summarizeIssues(result.issues).errors).toBe(0);
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
it('flags an unreadable source-theme catalog as invalid_theme', async () => {
|
|
242
|
+
const pkgDir = path.join(tmpDir, 'pkg');
|
|
243
|
+
writePackage(pkgDir, {
|
|
244
|
+
manifest: `export default { themes: './themes' };\n`,
|
|
245
|
+
});
|
|
246
|
+
fs.mkdirSync(path.join(pkgDir, 'themes'), {recursive: true});
|
|
247
|
+
fs.writeFileSync(path.join(pkgDir, 'themes', 'manifest.json'), '{not-json');
|
|
248
|
+
|
|
249
|
+
const result = await validateLocalIntegration(pkgDir);
|
|
250
|
+
expect(byCode(result.issues, 'invalid_theme')).toHaveLength(1);
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
it('warns when a component source has no same-stem metadata', async () => {
|
|
254
|
+
const pkgDir = path.join(tmpDir, 'pkg');
|
|
255
|
+
writePackage(pkgDir, {
|
|
256
|
+
manifest: `export default { components: './components' };\n`,
|
|
257
|
+
});
|
|
258
|
+
fs.mkdirSync(path.join(pkgDir, 'components'));
|
|
259
|
+
fs.writeFileSync(
|
|
260
|
+
path.join(pkgDir, 'components', 'InvisibleWidget.tsx'),
|
|
261
|
+
'export function InvisibleWidget() { return null; }\n',
|
|
262
|
+
);
|
|
263
|
+
|
|
264
|
+
const result = await validateLocalIntegration(pkgDir);
|
|
265
|
+
|
|
266
|
+
expect(byCode(result.issues, 'source_without_component_doc')).toEqual([
|
|
267
|
+
expect.objectContaining({
|
|
268
|
+
severity: 'warning',
|
|
269
|
+
message: expect.stringContaining('InvisibleWidget.doc.mjs'),
|
|
270
|
+
}),
|
|
271
|
+
]);
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
it('reports codemods outside semver folders and invalid folder names', async () => {
|
|
275
|
+
const pkgDir = path.join(tmpDir, 'pkg');
|
|
276
|
+
writePackage(pkgDir, {
|
|
277
|
+
manifest: `export default { codemods: './codemods' };\n`,
|
|
278
|
+
});
|
|
279
|
+
fs.mkdirSync(path.join(pkgDir, 'codemods', 'v1'), {recursive: true});
|
|
280
|
+
fs.writeFileSync(
|
|
281
|
+
path.join(pkgDir, 'codemods', 'forgotten.mjs'),
|
|
282
|
+
`export default {type: 'code', title: 'Forgotten', transform: file => file.source};\n`,
|
|
283
|
+
);
|
|
284
|
+
|
|
285
|
+
const result = await validateLocalIntegration(pkgDir);
|
|
286
|
+
|
|
287
|
+
expect(byCode(result.issues, 'codemod_outside_version')).toHaveLength(1);
|
|
288
|
+
expect(byCode(result.issues, 'invalid_codemod_version')).toHaveLength(1);
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
it('warns about valid contribution metadata outside every declared root', async () => {
|
|
292
|
+
const pkgDir = path.join(tmpDir, 'pkg');
|
|
293
|
+
writePackage(pkgDir, {manifest: 'export default {};\n'});
|
|
294
|
+
fs.mkdirSync(path.join(pkgDir, 'src'));
|
|
295
|
+
fs.writeFileSync(
|
|
296
|
+
path.join(pkgDir, 'src', 'orphan.doc.mjs'),
|
|
297
|
+
`export default ${JSON.stringify({
|
|
298
|
+
type: 'generic',
|
|
299
|
+
name: 'orphan',
|
|
300
|
+
title: 'Orphan',
|
|
301
|
+
description: 'Outside every root.',
|
|
302
|
+
sections: [
|
|
303
|
+
{title: 'Overview', content: [{type: 'prose', text: 'Orphan.'}]},
|
|
304
|
+
],
|
|
305
|
+
})};\n`,
|
|
306
|
+
);
|
|
307
|
+
fs.writeFileSync(
|
|
308
|
+
path.join(pkgDir, 'src', 'not-a-doc.doc.mjs'),
|
|
309
|
+
'export default {nope: true};\n',
|
|
310
|
+
);
|
|
311
|
+
fs.mkdirSync(path.join(pkgDir, 'dist'));
|
|
312
|
+
fs.writeFileSync(
|
|
313
|
+
path.join(pkgDir, 'dist', 'built.doc.mjs'),
|
|
314
|
+
`export default ${JSON.stringify({
|
|
315
|
+
type: 'generic',
|
|
316
|
+
name: 'built',
|
|
317
|
+
title: 'Built',
|
|
318
|
+
description: 'Generated output.',
|
|
319
|
+
sections: [
|
|
320
|
+
{title: 'Overview', content: [{type: 'prose', text: 'Built.'}]},
|
|
321
|
+
],
|
|
322
|
+
})};\n`,
|
|
323
|
+
);
|
|
324
|
+
|
|
325
|
+
const result = await validateLocalIntegration(pkgDir);
|
|
326
|
+
|
|
327
|
+
const unreachable = byCode(result.issues, 'unreachable_contribution');
|
|
328
|
+
expect(unreachable).toHaveLength(1);
|
|
329
|
+
expect(unreachable[0].message).toContain('src/orphan.doc.mjs');
|
|
330
|
+
});
|
|
331
|
+
|
|
332
|
+
it('never executes unreachable metadata while diagnosing it', async () => {
|
|
333
|
+
const pkgDir = path.join(tmpDir, 'pkg');
|
|
334
|
+
const marker = path.join(tmpDir, 'executed');
|
|
335
|
+
writePackage(pkgDir, {manifest: 'export default {};\n'});
|
|
336
|
+
fs.mkdirSync(path.join(pkgDir, 'src'));
|
|
337
|
+
fs.writeFileSync(
|
|
338
|
+
path.join(pkgDir, 'src', 'danger.doc.mjs'),
|
|
339
|
+
`import fs from 'node:fs';\nfs.writeFileSync(${JSON.stringify(marker)}, 'ran');\nexport default {type: 'generic', name: 'danger', title: 'Danger', description: 'Static only.', sections: []};\n`,
|
|
340
|
+
);
|
|
341
|
+
|
|
342
|
+
const result = await validateLocalIntegration(pkgDir);
|
|
343
|
+
|
|
344
|
+
expect(byCode(result.issues, 'unreachable_contribution')).toHaveLength(1);
|
|
345
|
+
expect(fs.existsSync(marker)).toBe(false);
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
it('reports malformed local package.json instead of losing package identity', async () => {
|
|
349
|
+
const pkgDir = path.join(tmpDir, 'pkg');
|
|
350
|
+
writePackage(pkgDir, {manifest: 'export default {};\n'});
|
|
351
|
+
fs.writeFileSync(path.join(pkgDir, 'package.json'), '{bad-json');
|
|
352
|
+
|
|
353
|
+
const result = await validateLocalIntegration(pkgDir);
|
|
354
|
+
|
|
355
|
+
expect(byCode(result.issues, 'invalid_package_json')).toHaveLength(1);
|
|
356
|
+
});
|
|
357
|
+
|
|
195
358
|
it('validates an installed package resolved from node_modules', async () => {
|
|
196
359
|
const consumer = path.join(tmpDir, 'consumer');
|
|
197
360
|
fs.mkdirSync(consumer, {recursive: true});
|
|
@@ -206,7 +369,10 @@ describe('validate-integration API', () => {
|
|
|
206
369
|
manifest: `export default { templates: './gone' };\n`,
|
|
207
370
|
});
|
|
208
371
|
|
|
209
|
-
const result = await validateInstalledIntegration(
|
|
372
|
+
const result = await validateInstalledIntegration(
|
|
373
|
+
'@acme/widgets',
|
|
374
|
+
consumer,
|
|
375
|
+
);
|
|
210
376
|
expect(result.found).toBe(true);
|
|
211
377
|
expect(result.name).toBe('@acme/widgets');
|
|
212
378
|
expect(result.version).toBe('2.0.0');
|
|
@@ -224,6 +390,24 @@ describe('validate-integration API', () => {
|
|
|
224
390
|
expect(byCode(result.issues, 'package_not_found')).toHaveLength(1);
|
|
225
391
|
});
|
|
226
392
|
|
|
393
|
+
it('reports malformed installed package.json distinctly from not found', async () => {
|
|
394
|
+
const consumer = path.join(tmpDir, 'consumer');
|
|
395
|
+
const pkgDir = path.join(consumer, 'node_modules', '@acme', 'widgets');
|
|
396
|
+
writePackage(pkgDir, {
|
|
397
|
+
name: '@acme/widgets',
|
|
398
|
+
manifest: 'export default {};\n',
|
|
399
|
+
});
|
|
400
|
+
fs.writeFileSync(path.join(pkgDir, 'package.json'), '{bad-json');
|
|
401
|
+
|
|
402
|
+
const result = await validateInstalledIntegration(
|
|
403
|
+
'@acme/widgets',
|
|
404
|
+
consumer,
|
|
405
|
+
);
|
|
406
|
+
|
|
407
|
+
expect(byCode(result.issues, 'invalid_package_json')).toHaveLength(1);
|
|
408
|
+
expect(byCode(result.issues, 'package_not_found')).toHaveLength(0);
|
|
409
|
+
});
|
|
410
|
+
|
|
227
411
|
it('reports no errors for a valid component (doc + same-stem source)', async () => {
|
|
228
412
|
const pkgDir = path.join(tmpDir, 'pkg');
|
|
229
413
|
writePackage(pkgDir, {
|
|
@@ -19,8 +19,8 @@ export const doc = {
|
|
|
19
19
|
'Validates exactly ONE integration at a time: the local package rooted at ' +
|
|
20
20
|
'cwd (no `pkg`), or an installed package resolved from cwd/node_modules ' +
|
|
21
21
|
'(`pkg` given). It loads and schema-checks the manifest, verifies each ' +
|
|
22
|
-
'declared contribution root exists, and runs the codemod/template/component
|
|
23
|
-
'validators, returning every finding as an AstryxIntegrationIssue. A missing ' +
|
|
22
|
+
'declared contribution root exists, and runs the codemod/template/component/' +
|
|
23
|
+
'docs/theme validators, returning every finding as an AstryxIntegrationIssue. A missing ' +
|
|
24
24
|
'local manifest is guidance (name null, no issues), not an error, so callers ' +
|
|
25
25
|
'can stay exit-0 in a non-integration directory.',
|
|
26
26
|
importPath: '@astryxdesign/cli/api',
|
package/api/json/index.ts
CHANGED
|
@@ -22,6 +22,7 @@ export type * from '../hook/hook.type.mjs';
|
|
|
22
22
|
export type * from '../search/search.type.mjs';
|
|
23
23
|
export type * from '../build/build.type.mjs';
|
|
24
24
|
export type * from '../swizzle/swizzle.type.mjs';
|
|
25
|
+
export type * from '../gap-report/gap-report.type.mjs';
|
|
25
26
|
export type * from '../upgrade/upgrade.type.mjs';
|
|
26
27
|
export type * from '../init/init.type.mjs';
|
|
27
28
|
export type * from '../doctor/doctor.type.mjs';
|
package/api/search/search.mjs
CHANGED
|
@@ -57,6 +57,7 @@ import {
|
|
|
57
57
|
discoverIntegrationComponents,
|
|
58
58
|
findComponentReadme,
|
|
59
59
|
resolveImportPath,
|
|
60
|
+
resolveIntegrationImportPath,
|
|
60
61
|
} from '../../foundation/discovery/component-discovery.mjs';
|
|
61
62
|
import {discoverHooks, findHookDoc} from '../../foundation/discovery/hook-discovery.mjs';
|
|
62
63
|
import {loadIntegrationsSafely} from '../component/_adapter.mjs';
|
|
@@ -552,7 +553,24 @@ async function gatherIntegrationComponents(cwd) {
|
|
|
552
553
|
keywords: doc && Array.isArray(doc.keywords) ? doc.keywords : [],
|
|
553
554
|
description: doc ? doc.usage?.description || doc.description || '' : '',
|
|
554
555
|
guidance: guidanceFrom(doc),
|
|
555
|
-
|
|
556
|
+
// Exactly what `component` reports: a doc may state its own specifier
|
|
557
|
+
// (one entry point exporting several components), and only when it
|
|
558
|
+
// does not do we resolve the subpath against the owning package's
|
|
559
|
+
// exports — read off the integration, which the loader already parsed.
|
|
560
|
+
// Reporting the bare package name here handed out a path that does not
|
|
561
|
+
// resolve, and disagreed with what `component <Name>` said about the
|
|
562
|
+
// very same component.
|
|
563
|
+
_import:
|
|
564
|
+
doc?.import ??
|
|
565
|
+
resolveIntegrationImportPath(
|
|
566
|
+
{
|
|
567
|
+
exportsMap: integration.__packageExports,
|
|
568
|
+
packageDir: integration.__packageDir,
|
|
569
|
+
docPath: rec.docPath,
|
|
570
|
+
packageName: rec.package,
|
|
571
|
+
},
|
|
572
|
+
rec.name,
|
|
573
|
+
),
|
|
556
574
|
});
|
|
557
575
|
}
|
|
558
576
|
}
|
package/api/theme/_adapter.d.mts
CHANGED
|
@@ -2,41 +2,39 @@
|
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* A
|
|
6
|
-
* @typedef {
|
|
7
|
-
* @property {string} slug
|
|
8
|
-
* @property {string} displayName
|
|
9
|
-
* @property {string} description
|
|
10
|
-
* @property {boolean} maintained
|
|
11
|
-
* @property {string} entry
|
|
12
|
-
* @property {string} exportName
|
|
13
|
-
* @property {string[]} files
|
|
5
|
+
* A bundled theme entry kept for the historical public `listThemes()` helper.
|
|
6
|
+
* @typedef {Pick<import('../../foundation/discovery/theme-discovery.mjs').DiscoveredTheme, 'slug' | 'displayName' | 'description' | 'maintained' | 'entry' | 'exportName' | 'files'>} BundledTheme
|
|
14
7
|
*/
|
|
15
8
|
/**
|
|
16
|
-
*
|
|
9
|
+
* The themes bundled in this CLI build. Kept synchronous for compatibility with
|
|
10
|
+
* programmatic callers that use this low-level helper directly.
|
|
17
11
|
* @returns {BundledTheme[]}
|
|
18
12
|
*/
|
|
19
13
|
export function listThemes(): BundledTheme[];
|
|
20
14
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
15
|
+
* Bundled themes plus source themes from integrations installed in `cwd`.
|
|
16
|
+
* A project/config load failure degrades to the bundled catalog, preserving the
|
|
17
|
+
* command's historical usefulness outside a configured project.
|
|
18
|
+
* @param {string} [cwd]
|
|
19
|
+
* @returns {Promise<import('../../foundation/discovery/theme-discovery.mjs').DiscoveredTheme[]>}
|
|
20
|
+
*/
|
|
21
|
+
export function listAvailableThemes(cwd?: string): Promise<import("../../foundation/discovery/theme-discovery.mjs").DiscoveredTheme[]>;
|
|
22
|
+
/**
|
|
23
|
+
* Resolve an available theme by case-insensitive slug and optional owner package.
|
|
24
|
+
* Duplicate slugs fail closed until the caller selects an owner.
|
|
23
25
|
* @param {string} [slug]
|
|
24
|
-
* @
|
|
26
|
+
* @param {{cwd?: string, package?: string}} [options]
|
|
27
|
+
* @returns {Promise<import('../../foundation/discovery/theme-discovery.mjs').DiscoveredTheme | undefined>}
|
|
25
28
|
*/
|
|
26
|
-
export function findTheme(slug?: string
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
export const MANIFEST_PATH: string;
|
|
29
|
+
export function findTheme(slug?: string, options?: {
|
|
30
|
+
cwd?: string;
|
|
31
|
+
package?: string;
|
|
32
|
+
}): Promise<import("../../foundation/discovery/theme-discovery.mjs").DiscoveredTheme | undefined>;
|
|
31
33
|
/**
|
|
32
|
-
* A
|
|
34
|
+
* A bundled theme entry kept for the historical public `listThemes()` helper.
|
|
33
35
|
*/
|
|
34
|
-
export type BundledTheme =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
entry: string;
|
|
40
|
-
exportName: string;
|
|
41
|
-
files: string[];
|
|
42
|
-
};
|
|
36
|
+
export type BundledTheme = Pick<import("../../foundation/discovery/theme-discovery.mjs").DiscoveredTheme, "slug" | "displayName" | "description" | "maintained" | "entry" | "exportName" | "files">;
|
|
37
|
+
import { BUNDLED_THEME_PACKAGE } from '../../foundation/discovery/theme-discovery.mjs';
|
|
38
|
+
import { MANIFEST_PATH } from '../../foundation/discovery/theme-discovery.mjs';
|
|
39
|
+
import { THEMES_DIR } from '../../foundation/discovery/theme-discovery.mjs';
|
|
40
|
+
export { BUNDLED_THEME_PACKAGE, MANIFEST_PATH, THEMES_DIR };
|