@astryxdesign/cli 0.7.16-canary.gd1d1251 → 0.7.16-canary.gfef050d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/api/build/_adapter.d.mts +1 -0
- package/api/build/blocks/blocks.d.mts +1 -0
- package/api/build/blocks/blocks.mjs +18 -1
- package/api/component/__fixtures__/resolutions/modules.txt +1 -1
- package/api/doctor/_adapter.d.mts +21 -2
- package/api/doctor/_adapter.mjs +41 -1
- package/api/doctor/built-checks.mjs +1 -1
- package/api/doctor/doctor.d.mts +26 -0
- package/api/doctor/doctor.doc.mjs +1 -1
- package/api/doctor/doctor.mjs +139 -8
- package/api/doctor/theme-checks.mjs +163 -18
- package/api/icon/_adapter.d.mts +7 -3
- package/api/icon/_adapter.mjs +12 -3
- package/api/icon/icon.type.d.mts +15 -0
- package/api/icon/icon.type.mjs +10 -3
- package/api/icon/iconUse.doc.mjs +19 -5
- package/api/icon/list/list.mjs +7 -1
- package/api/icon/use/use.d.mts +8 -5
- package/api/icon/use/use.mjs +95 -13
- package/api/init/run/run.mjs +1 -0
- package/api/integration/add-contribution.mjs +3 -3
- package/api/integration/pack-check.mjs +14 -8
- package/api/search/_adapter.mjs +15 -16
- package/api/search/_entries.d.mts +2 -1
- package/api/search/_entries.mjs +28 -1
- package/api/swizzle/_moduleGraph.mjs +1 -1
- package/api/template/template.type.d.mts +6 -2
- package/api/template/template.type.mjs +2 -1
- package/api/theme/_adapter.mjs +16 -2
- package/api/theme/_fork.mjs +1 -1
- package/api/theme/build/build.d.mts +110 -14
- package/api/theme/build/build.mjs +224 -100
- package/api/theme/generateTonalPalette.doc.mjs +2 -2
- package/api/theme/palette/generate/generator.mjs +141 -2
- package/api/theme/theme.type.d.mts +39 -0
- package/api/theme/theme.type.mjs +21 -0
- package/api/theme/themeBuild.doc.mjs +1 -1
- package/api/theme/themePaletteGenerate.doc.mjs +1 -1
- package/api/theme-edit/_adapter.d.mts +8 -10
- package/api/theme-edit/_adapter.mjs +113 -55
- package/api/theme-edit/_check.d.mts +58 -7
- package/api/theme-edit/_check.mjs +482 -108
- package/api/theme-edit/_context.d.mts +2 -1
- package/api/theme-edit/_context.mjs +116 -11
- package/api/theme-edit/_edit.d.mts +16 -0
- package/api/theme-edit/_edit.mjs +621 -54
- package/api/theme-edit/_how-question.d.mts +8 -0
- package/api/theme-edit/_how-question.mjs +169 -22
- package/api/theme-edit/_marks.d.mts +13 -0
- package/api/theme-edit/_marks.mjs +15 -0
- package/api/theme-edit/_palette.d.mts +27 -0
- package/api/theme-edit/_palette.mjs +112 -8
- package/api/theme-edit/_parts.d.mts +17 -0
- package/api/theme-edit/_parts.mjs +82 -5
- package/api/theme-edit/_png.d.mts +18 -0
- package/api/theme-edit/_png.mjs +76 -0
- package/api/theme-edit/_preview-app.d.mts +52 -1
- package/api/theme-edit/_preview-app.mjs +718 -65
- package/api/theme-edit/_preview.d.mts +57 -2
- package/api/theme-edit/_preview.mjs +282 -12
- package/api/theme-edit/_project.d.mts +4 -0
- package/api/theme-edit/_project.mjs +38 -9
- package/api/theme-edit/_settings.d.mts +123 -2
- package/api/theme-edit/_settings.mjs +867 -168
- package/api/theme-edit/_tables.mjs +1 -1
- package/api/theme-edit/theme-edit.type.d.mts +30 -2
- package/api/theme-edit/theme-edit.type.mjs +10 -2
- package/api/theme-edit/themeEditPreviewApp.doc.mjs +1 -1
- package/assets/codemods/parse.mjs +2 -2
- package/assets/docs/author-a-theme.doc.mjs +1 -1
- package/assets/docs/theme.doc.dense.mjs +1 -1
- package/assets/docs/theme.doc.mjs +1 -1
- package/assets/docs/theme.doc.zh.mjs +4 -3
- package/assets/docs/tree/define-the-theme.doc.mjs +1 -1
- package/assets/docs/tree/icon-sets.doc.mjs +63 -8
- package/assets/docs.generated.json +2 -2
- package/assets/self-audit.generated.json +1 -1
- package/assets/templates/blocks/components/Outline/useOutlineFromDOMHookUsage.doc.mjs +21 -0
- package/assets/templates/blocks/components/Outline/useOutlineFromDOMHookUsage.tsx +62 -0
- package/assets/templates/components.generated.json +1 -1
- package/assets/templates/pages/ai-chat/page.tsx +20 -2
- package/assets/templates/themes/neutral/neutralPalettes.generated.receipt.json +2 -0
- package/authoring/config/config.doc.mjs +8 -0
- package/authoring/config/parse.d.mts +1 -0
- package/authoring/config/parse.mjs +12 -0
- package/authoring/config/type.ts +8 -0
- package/authoring/doctypes/icon-set/icon-set-data.doc.mjs +3 -3
- package/authoring/shadcn/source-variants.d.mts +1 -1
- package/authoring/shadcn/source-variants.mjs +32 -10
- package/clients/cli/build-id.generated.json +1 -1
- package/clients/cli/commands/experimental/icon.mjs +61 -6
- package/clients/cli/commands/experimental/theme.mjs +54 -8
- package/clients/cli/commands/experimental-icon-use.doc.mjs +12 -5
- package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-preview-add.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +1 -1
- package/clients/cli/commands/theme.doc.mjs +7 -2
- package/clients/cli/commands/theme.mjs +80 -29
- package/clients/cli/commands.generated.json +1 -1
- package/clients/cli/index.mjs +25 -5
- package/clients/cli/lib/json-shim.mjs +44 -12
- package/clients/cli/manifest.generated.json +1 -1
- package/foundation/agent-docs/agent-docs-target.d.mts +2 -6
- package/foundation/agent-docs/agent-docs-target.mjs +9 -17
- package/foundation/agent-docs/agent-docs.mjs +4 -3
- package/foundation/config/config-writer.d.mts +23 -0
- package/foundation/config/config-writer.mjs +152 -58
- package/foundation/config/project.mjs +53 -2
- package/foundation/discovery/component-discovery.mjs +11 -22
- package/foundation/discovery/icon-set-checks.mjs +164 -48
- package/foundation/discovery/icon-set-discovery.d.mts +38 -5
- package/foundation/discovery/icon-set-discovery.mjs +50 -6
- package/foundation/discovery/icon-set-theme-maps.d.mts +59 -0
- package/foundation/discovery/icon-set-theme-maps.mjs +95 -0
- package/foundation/discovery/icon-set-writer.d.mts +2 -3
- package/foundation/discovery/icon-set-writer.mjs +58 -17
- package/foundation/discovery/module-exports.mjs +1 -15
- package/foundation/discovery/template-adapter.mjs +44 -19
- package/foundation/discovery/template-icons.d.mts +27 -10
- package/foundation/discovery/template-icons.mjs +142 -26
- package/foundation/discovery/template-source-tree.mjs +3 -16
- package/foundation/discovery/theme-discovery.d.mts +25 -0
- package/foundation/discovery/theme-discovery.mjs +86 -48
- package/foundation/fs/exact-codec.d.mts +35 -0
- package/foundation/fs/exact-codec.mjs +148 -0
- package/foundation/fs/gather-cache.d.mts +6 -3
- package/foundation/fs/gather-cache.mjs +53 -19
- package/foundation/fs/paths.d.mts +8 -0
- package/foundation/fs/paths.mjs +1 -1
- package/foundation/fs/read-record.mjs +11 -1
- package/foundation/integrations/autolink.d.mts +4 -2
- package/foundation/integrations/autolink.mjs +4 -2
- package/foundation/integrations/cli-requirement.d.mts +16 -5
- package/foundation/integrations/cli-requirement.mjs +27 -6
- package/foundation/integrations/contribution-fixes.mjs +1 -16
- package/foundation/integrations/may-have-integrations.mjs +7 -3
- package/foundation/integrations/missing-dependency.d.mts +9 -0
- package/foundation/integrations/missing-dependency.mjs +100 -0
- package/foundation/integrations/public-imports.mjs +1 -1
- package/foundation/render/embedded-imports.mjs +1 -1
- package/foundation/runtime/lazy-dependencies.d.mts +14 -0
- package/foundation/runtime/lazy-dependencies.mjs +82 -0
- package/foundation/xle/browser.d.mts +2 -2
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -112,7 +112,7 @@ Each command declares what it does in a folder outside any project, and `astryx
|
|
|
112
112
|
| `search` | Search components, hooks, docs, templates, and themes in one ranked list | `same` |
|
|
113
113
|
| `swizzle` | Copy component source for customization | `refuse` |
|
|
114
114
|
| `template` | List, show, or scaffold page and block templates | `same` |
|
|
115
|
-
| `theme` | Add, switch, build, and author themes
|
|
115
|
+
| `theme` | Add, switch, build, and author themes (to make or change one, use experimental theme editor) | by subcommand |
|
|
116
116
|
| `upgrade` | Update your code after upgrading Astryx, and refresh ShadCN-copied components | `own` |
|
|
117
117
|
|
|
118
118
|
<!-- END GENERATED: commands -->
|
package/api/build/_adapter.d.mts
CHANGED
|
@@ -77,6 +77,7 @@ export function loadTreeWeights(): import("../../foundation/route/route.mjs").Cl
|
|
|
77
77
|
export function keptBlockCatalog<T>(key: unknown[], compute: () => T, codec: {
|
|
78
78
|
encode: (value: T) => any;
|
|
79
79
|
decode: (stored: any) => T;
|
|
80
|
+
valid?: (value: any) => boolean;
|
|
80
81
|
}): T;
|
|
81
82
|
/**
|
|
82
83
|
* The block picker's weights (blocks/blocks.weights.json), read once; null
|
|
@@ -90,6 +90,7 @@ export function pickBlocks(request: string, signals: {
|
|
|
90
90
|
export type KeepCatalog = <T>(key: unknown[], compute: () => T, codec: {
|
|
91
91
|
encode: (value: T) => any;
|
|
92
92
|
decode: (stored: any) => T;
|
|
93
|
+
valid?: (value: any) => boolean;
|
|
93
94
|
}) => T;
|
|
94
95
|
export type BlockPickerWeights = {
|
|
95
96
|
/**
|
|
@@ -45,7 +45,7 @@ import {STOPWORDS} from '../../search/_query.mjs';
|
|
|
45
45
|
/**
|
|
46
46
|
* Keeps a value derived from the catalog between runs (build's adapter does
|
|
47
47
|
* it beside the kept search catalog), or works it out.
|
|
48
|
-
* @typedef {<T>(key: unknown[], compute: () => T, codec: {encode: (value: T) => any, decode: (stored: any) => T}) => T} KeepCatalog
|
|
48
|
+
* @typedef {<T>(key: unknown[], compute: () => T, codec: {encode: (value: T) => any, decode: (stored: any) => T, valid?: (value: any) => boolean}) => T} KeepCatalog
|
|
49
49
|
*/
|
|
50
50
|
|
|
51
51
|
/**
|
|
@@ -410,6 +410,23 @@ function computeCatalog(key, catalog, components, weights) {
|
|
|
410
410
|
* projection as its numbers.
|
|
411
411
|
*/
|
|
412
412
|
const CATALOG_CODEC = {
|
|
413
|
+
/**
|
|
414
|
+
* What decode can get wrong in a read-back catalog: its key, each block's
|
|
415
|
+
* component, and projections of one width with finite numbers.
|
|
416
|
+
* @param {any} read
|
|
417
|
+
*/
|
|
418
|
+
valid: read => {
|
|
419
|
+
if (read == null || typeof read.key !== 'string') return false;
|
|
420
|
+
const blocks = [...read.blocks.values()];
|
|
421
|
+
const width = blocks[0]?.projected.length;
|
|
422
|
+
return blocks.every(
|
|
423
|
+
(/** @type {any} */ b) =>
|
|
424
|
+
typeof b.component === 'string' &&
|
|
425
|
+
b.projected.length > 0 &&
|
|
426
|
+
b.projected.length === width &&
|
|
427
|
+
[...b.projected].every(Number.isFinite),
|
|
428
|
+
);
|
|
429
|
+
},
|
|
413
430
|
/** @param {ReturnType<typeof computeCatalog>} read */
|
|
414
431
|
encode: read => ({
|
|
415
432
|
key: read.key,
|
|
@@ -277,7 +277,7 @@ useMenuDrillIn useMenuDrillIn DropdownMenu/DropdownMenu.doc.mjs DropdownMenu/use
|
|
|
277
277
|
useMenuHover useMenuHover hooks/useAnimatedLayout.doc.mjs hooks/useMenuHover.ts
|
|
278
278
|
useMenuOverflow useMenuOverflow DropdownMenu/DropdownMenu.doc.mjs DropdownMenu/useMenuOverflow.ts
|
|
279
279
|
useMobileKeyboard ERR_UNKNOWN_COMPONENT - keyboard/useMobileKeyboard.ts
|
|
280
|
-
useOutlineFromDOM useOutlineFromDOM Outline/
|
|
280
|
+
useOutlineFromDOM useOutlineFromDOM Outline/useOutlineFromDOM.doc.mjs Outline/useOutlineFromDOM.ts
|
|
281
281
|
useOverlay useOverlay Overlay/useOverlay.doc.mjs Overlay/useOverlay.tsx
|
|
282
282
|
useOwnScrollGesture useOwnScrollGesture DateInput/DateInput.doc.mjs DateInput/useOwnScrollGesture.ts
|
|
283
283
|
usePager usePager hooks/useAnimatedLayout.doc.mjs hooks/usePager.ts
|
|
@@ -88,6 +88,24 @@ export function doctorElementPropOrigins(file: string, element: Parameters<typeo
|
|
|
88
88
|
* @returns {Set<string>}
|
|
89
89
|
*/
|
|
90
90
|
export function doctorStylesheetImports(css: string): Set<string>;
|
|
91
|
+
/**
|
|
92
|
+
* The `@astryxdesign/core` range a package's peerDependencies declare, and
|
|
93
|
+
* whether it accepts `coreVersion` (spec:AST-017/FR12). The one rule every
|
|
94
|
+
* doctor check uses to compare a package with the installed Core:
|
|
95
|
+
* `theme-core-peers` for added theme packages, `integration-core-range` for
|
|
96
|
+
* every other loaded integration.
|
|
97
|
+
* @param {{peerDependencies?: Record<string, unknown>} | null | undefined} pkg
|
|
98
|
+
* @param {string | null | undefined} coreVersion
|
|
99
|
+
* Any declared string is judged by `satisfiesRange`, so an empty range
|
|
100
|
+
* accepts every Core; only a missing range is `null`.
|
|
101
|
+
* @returns {{range: string | null, accepts: boolean}}
|
|
102
|
+
*/
|
|
103
|
+
export function corePeerRange(pkg: {
|
|
104
|
+
peerDependencies?: Record<string, unknown>;
|
|
105
|
+
} | null | undefined, coreVersion: string | null | undefined): {
|
|
106
|
+
range: string | null;
|
|
107
|
+
accepts: boolean;
|
|
108
|
+
};
|
|
91
109
|
/** @param {string} projectDir */
|
|
92
110
|
export function findDoctorCoreDir(projectDir: string): string | null;
|
|
93
111
|
/** @param {string} projectDir @param {string} packageName */
|
|
@@ -264,7 +282,6 @@ export function readBuiltPath(target: string, { fileLimit }?: {
|
|
|
264
282
|
*/
|
|
265
283
|
export function builtIntegrationPackages(target: string, cwd: string): string[];
|
|
266
284
|
export { placeholderFixes } from "../../foundation/discovery/template-icons.mjs";
|
|
267
|
-
export { unlistedIconSets } from "../../foundation/discovery/icon-set-discovery.mjs";
|
|
268
285
|
export { installCommandFor as packageInstallCommand } from "../../foundation/discovery/template-needs.mjs";
|
|
269
286
|
export { resolveRecordedTheme } from "../theme/theme.mjs";
|
|
270
287
|
export { collectUnloadedFonts } from "../theme/build/font-warning.mjs";
|
|
@@ -280,6 +297,8 @@ import { lastNoticeSkip } from '../../foundation/release/notices.mjs';
|
|
|
280
297
|
import { lastCheckFailure } from '../../foundation/release/global-state.mjs';
|
|
281
298
|
import { stateLockHolder } from '../../foundation/release/global-state.mjs';
|
|
282
299
|
import { displayHomePath } from '../../foundation/agent-docs/computer-agent-text.mjs';
|
|
300
|
+
export { iconUseCommand, unlistedIconSets } from "../../foundation/discovery/icon-set-discovery.mjs";
|
|
283
301
|
export { isLocalThemeOwner, planThemeAppWrite, readThemeState, resolveThemeModule } from "../../foundation/config/theme-state.mjs";
|
|
284
|
-
export { missingThemePackage, themeBuild, validateThemePrivateInputs } from "../theme/build/build.mjs";
|
|
302
|
+
export { GENERATED_MARKER, isPrivateVarRefusal, missingThemePackage, themeBuild, validateThemePrivateInputs } from "../theme/build/build.mjs";
|
|
303
|
+
export { APP_COPY_MARK, EDITOR_GENERATED_MARK } from "../theme-edit/_marks.mjs";
|
|
285
304
|
export { AUTHORING_AUDIT, authoringAudit, authoringAuditData } from "./_authoring-audit.mjs";
|
package/api/doctor/_adapter.mjs
CHANGED
|
@@ -41,9 +41,13 @@ import {computerAgentTextSettings} from '../../foundation/env/user-settings.mjs'
|
|
|
41
41
|
import * as fs from 'node:fs';
|
|
42
42
|
import {placeholderUses} from '../../foundation/discovery/template-icons.mjs';
|
|
43
43
|
export {placeholderFixes} from '../../foundation/discovery/template-icons.mjs';
|
|
44
|
-
export {
|
|
44
|
+
export {
|
|
45
|
+
iconUseCommand,
|
|
46
|
+
unlistedIconSets,
|
|
47
|
+
} from '../../foundation/discovery/icon-set-discovery.mjs';
|
|
45
48
|
import {elementPropOrigins} from '../../foundation/discovery/module-exports.mjs';
|
|
46
49
|
import {cssImports} from '../../foundation/render/embedded-imports.mjs';
|
|
50
|
+
import {satisfiesRange} from '../../foundation/env/semver.mjs';
|
|
47
51
|
import * as path from 'node:path';
|
|
48
52
|
import {
|
|
49
53
|
persistedGather,
|
|
@@ -72,10 +76,13 @@ export {
|
|
|
72
76
|
resolveThemeModule,
|
|
73
77
|
} from '../../foundation/config/theme-state.mjs';
|
|
74
78
|
export {
|
|
79
|
+
GENERATED_MARKER,
|
|
80
|
+
isPrivateVarRefusal,
|
|
75
81
|
missingThemePackage,
|
|
76
82
|
themeBuild,
|
|
77
83
|
validateThemePrivateInputs,
|
|
78
84
|
} from '../theme/build/build.mjs';
|
|
85
|
+
export {APP_COPY_MARK, EDITOR_GENERATED_MARK} from '../theme-edit/_marks.mjs';
|
|
79
86
|
export {installCommandFor as packageInstallCommand} from '../../foundation/discovery/template-needs.mjs';
|
|
80
87
|
export {resolveRecordedTheme} from '../theme/theme.mjs';
|
|
81
88
|
export {collectUnloadedFonts} from '../theme/build/font-warning.mjs';
|
|
@@ -92,6 +99,14 @@ export {
|
|
|
92
99
|
const CHECK_CODEC = {
|
|
93
100
|
encode: (/** @type {any} */ check) => check,
|
|
94
101
|
decode: (/** @type {any} */ check) => check,
|
|
102
|
+
/** A check record: its id, label, status and message. */
|
|
103
|
+
valid: (/** @type {any} */ check) =>
|
|
104
|
+
check != null &&
|
|
105
|
+
typeof check === 'object' &&
|
|
106
|
+
typeof check.id === 'string' &&
|
|
107
|
+
typeof check.label === 'string' &&
|
|
108
|
+
typeof check.status === 'string' &&
|
|
109
|
+
typeof check.message === 'string',
|
|
95
110
|
};
|
|
96
111
|
|
|
97
112
|
/**
|
|
@@ -291,6 +306,31 @@ export function doctorStylesheetImports(css) {
|
|
|
291
306
|
return new Set(cssImports(css));
|
|
292
307
|
}
|
|
293
308
|
|
|
309
|
+
/**
|
|
310
|
+
* The `@astryxdesign/core` range a package's peerDependencies declare, and
|
|
311
|
+
* whether it accepts `coreVersion` (spec:AST-017/FR12). The one rule every
|
|
312
|
+
* doctor check uses to compare a package with the installed Core:
|
|
313
|
+
* `theme-core-peers` for added theme packages, `integration-core-range` for
|
|
314
|
+
* every other loaded integration.
|
|
315
|
+
* @param {{peerDependencies?: Record<string, unknown>} | null | undefined} pkg
|
|
316
|
+
* @param {string | null | undefined} coreVersion
|
|
317
|
+
* Any declared string is judged by `satisfiesRange`, so an empty range
|
|
318
|
+
* accepts every Core; only a missing range is `null`.
|
|
319
|
+
* @returns {{range: string | null, accepts: boolean}}
|
|
320
|
+
*/
|
|
321
|
+
export function corePeerRange(pkg, coreVersion) {
|
|
322
|
+
const raw = pkg?.peerDependencies?.['@astryxdesign/core'];
|
|
323
|
+
const range = typeof raw === 'string' ? raw.trim() : null;
|
|
324
|
+
return {
|
|
325
|
+
range,
|
|
326
|
+
accepts:
|
|
327
|
+
range !== null &&
|
|
328
|
+
typeof coreVersion === 'string' &&
|
|
329
|
+
coreVersion !== '' &&
|
|
330
|
+
satisfiesRange(coreVersion, range),
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
|
|
294
334
|
/** @param {string} projectDir */
|
|
295
335
|
export function findDoctorCoreDir(projectDir) {
|
|
296
336
|
return findProjectCoreDir(projectDir);
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
resolveBuiltPath,
|
|
31
31
|
} from './_adapter.mjs';
|
|
32
32
|
import {formatCliCommand} from '../../foundation/env/package-manager.mjs';
|
|
33
|
-
import {
|
|
33
|
+
import {babelParse as parseModule} from '../../foundation/runtime/lazy-dependencies.mjs';
|
|
34
34
|
|
|
35
35
|
/** Source files, read for imports and JSX. */
|
|
36
36
|
const SOURCE_EXT = new Set(['.tsx', '.jsx', '.ts', '.js', '.mjs', '.cjs']);
|
package/api/doctor/doctor.d.mts
CHANGED
|
@@ -86,6 +86,19 @@ export function checkPeerDeps(ctx: DoctorContext): DoctorCheck;
|
|
|
86
86
|
* @returns {DoctorCheck}
|
|
87
87
|
*/
|
|
88
88
|
export function checkIntegrationIssues(ctx: DoctorContext): DoctorCheck;
|
|
89
|
+
/**
|
|
90
|
+
* Every loaded integration's `@astryxdesign/core` peer range admits the
|
|
91
|
+
* installed Core: a package's declared peer ranges define the Core versions it
|
|
92
|
+
* supports (spec:AST-017 FR12). A package made for another Core installs with
|
|
93
|
+
* only a package manager warning, and its components, themes and docs may not
|
|
94
|
+
* work. New, so it warns: a project that passed before keeps passing.
|
|
95
|
+
* Packages of added themes are left to `theme-core-peers` (spec:AST-050 FR11),
|
|
96
|
+
* which applies the same rule. Null when Core is not installed or no other
|
|
97
|
+
* loaded integration declares a Core range.
|
|
98
|
+
* @param {DoctorContext} ctx
|
|
99
|
+
* @returns {DoctorCheck | null}
|
|
100
|
+
*/
|
|
101
|
+
export function checkIntegrationCoreRange(ctx: DoctorContext): DoctorCheck | null;
|
|
89
102
|
/**
|
|
90
103
|
* The project's icon sets (AST-084 FR17). Fails when `experimental.iconSet`
|
|
91
104
|
* names a set, main or backup, that is not installed, that is installed but
|
|
@@ -387,6 +400,11 @@ export type DoctorContext = {
|
|
|
387
400
|
* false means the copy that started the run answered it (spec AST-081 FR2).
|
|
388
401
|
*/
|
|
389
402
|
ownCli?: boolean | undefined;
|
|
403
|
+
/**
|
|
404
|
+
* - Packages of the project's added
|
|
405
|
+
* themes, which `theme-core-peers` checks against Core
|
|
406
|
+
*/
|
|
407
|
+
addedThemePackages?: string[] | undefined;
|
|
390
408
|
/**
|
|
391
409
|
* - The Core release the project names
|
|
392
410
|
* (installed, else locked, else declared), as the daily hint reads it.
|
|
@@ -464,6 +482,14 @@ export type DoctorContext = {
|
|
|
464
482
|
status: "selected" | "none" | "ambiguous" | "missing" | "withdrawn";
|
|
465
483
|
reason: string;
|
|
466
484
|
configured?: string;
|
|
485
|
+
set?: {
|
|
486
|
+
name: string;
|
|
487
|
+
package: string;
|
|
488
|
+
data: {
|
|
489
|
+
variants?: string[];
|
|
490
|
+
};
|
|
491
|
+
};
|
|
492
|
+
variant?: string;
|
|
467
493
|
backups?: Array<{
|
|
468
494
|
selector: string;
|
|
469
495
|
status: "selected" | "ambiguous" | "missing" | "withdrawn";
|
|
@@ -20,7 +20,7 @@ export const doc = {
|
|
|
20
20
|
'@astryxdesign/core install and version alignment with the CLI, installed ' +
|
|
21
21
|
'themes and wiring, astryx.config validity, whether every integration ' +
|
|
22
22
|
'astryx.config names loads (a failed one fails the run), integrations linked from ' +
|
|
23
|
-
'package.json without a config entry, core peer dependencies, ' +
|
|
23
|
+
'package.json without a config entry, core peer dependencies, whether the @astryxdesign/core peer range of each loaded integration includes the installed Core (`integration-core-range`, a warning; added theme packages are checked by `theme-core-peers` instead), ' +
|
|
24
24
|
'integration provider identity and contribution issues, agent docs, the ' +
|
|
25
25
|
'detected package manager, and the health of the docs the CLI reads (authoring ' +
|
|
26
26
|
'and CLI docs, the docs tree, doc size), and returns a structured ' +
|
package/api/doctor/doctor.mjs
CHANGED
|
@@ -110,6 +110,7 @@ import {
|
|
|
110
110
|
projectHasOwnCli,
|
|
111
111
|
computerIntegrationsOutside,
|
|
112
112
|
findIconPlaceholders,
|
|
113
|
+
iconUseCommand,
|
|
113
114
|
placeholderFixes,
|
|
114
115
|
unlistedIconSets,
|
|
115
116
|
computerIntegrationsToAdd,
|
|
@@ -118,6 +119,9 @@ import {
|
|
|
118
119
|
releaseFacts,
|
|
119
120
|
builtIntegrationPackages,
|
|
120
121
|
authoringAudit,
|
|
122
|
+
corePeerRange,
|
|
123
|
+
isLocalThemeOwner,
|
|
124
|
+
readThemeState,
|
|
121
125
|
} from './_adapter.mjs';
|
|
122
126
|
import {checkBuilt} from './built-checks.mjs';
|
|
123
127
|
|
|
@@ -141,6 +145,8 @@ import {checkBuilt} from './built-checks.mjs';
|
|
|
141
145
|
* @property {string|null} coreDir - Resolved core package directory, or null.
|
|
142
146
|
* @property {boolean} [ownCli] - Whether the project installs its own CLI;
|
|
143
147
|
* false means the copy that started the run answered it (spec AST-081 FR2).
|
|
148
|
+
* @property {string[]} [addedThemePackages] - Packages of the project's added
|
|
149
|
+
* themes, which `theme-core-peers` checks against Core
|
|
144
150
|
* @property {string|null} [projectCore] - The Core release the project names
|
|
145
151
|
* (installed, else locked, else declared), as the daily hint reads it.
|
|
146
152
|
* @property {string|null} configPath - Resolved astryx.config.mjs path, or null.
|
|
@@ -163,7 +169,7 @@ import {checkBuilt} from './built-checks.mjs';
|
|
|
163
169
|
* Combined project-level integration issues, including cross-package template replacement warnings.
|
|
164
170
|
* @property {Error|null} [configError] - Error thrown while resolving the config
|
|
165
171
|
* path (e.g. multiple config files present), surfaced by checkConfig as a FAIL.
|
|
166
|
-
* @property {{sets: Array<{name: string, package: string}>, withdrawn: Array<{name: string, package: string, reason: string}>, choice: {status: 'selected'|'none'|'ambiguous'|'missing'|'withdrawn', reason: string, configured?: string, backups?: Array<{selector: string, status: 'selected'|'ambiguous'|'missing'|'withdrawn', reason: string}>, order?: Array<{name: string, package: string}>}}|null} [iconSets]
|
|
172
|
+
* @property {{sets: Array<{name: string, package: string}>, withdrawn: Array<{name: string, package: string, reason: string}>, choice: {status: 'selected'|'none'|'ambiguous'|'missing'|'withdrawn', reason: string, configured?: string, set?: {name: string, package: string, data: {variants?: string[]}}, variant?: string, backups?: Array<{selector: string, status: 'selected'|'ambiguous'|'missing'|'withdrawn', reason: string}>, order?: Array<{name: string, package: string}>}}|null} [iconSets]
|
|
167
173
|
* The project's icon sets (AST-084 FR17), or null when they could not be read.
|
|
168
174
|
* Experimental: may change or be removed in a patch release.
|
|
169
175
|
* @property {Array<{file: string, local: string, meanings: string[] | null, uses: number}>|null} [iconPlaceholders]
|
|
@@ -191,6 +197,22 @@ function readPkg(pkgPath) {
|
|
|
191
197
|
}
|
|
192
198
|
}
|
|
193
199
|
|
|
200
|
+
/**
|
|
201
|
+
* Packages that own the project's added themes (local themes excluded); empty
|
|
202
|
+
* when the project manages no themes or its theme state cannot be read.
|
|
203
|
+
* @param {string} cwd
|
|
204
|
+
* @returns {string[]}
|
|
205
|
+
*/
|
|
206
|
+
function addedThemePackages(cwd) {
|
|
207
|
+
try {
|
|
208
|
+
return Object.values(readThemeState(cwd).themes ?? {}).filter(
|
|
209
|
+
owner => typeof owner === 'string' && !isLocalThemeOwner(owner),
|
|
210
|
+
);
|
|
211
|
+
} catch {
|
|
212
|
+
return [];
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
194
216
|
/**
|
|
195
217
|
* Read the version of an installed package from a resolved directory.
|
|
196
218
|
* @param {string|null} dir
|
|
@@ -631,9 +653,11 @@ export function checkImplicitIntegrations(ctx) {
|
|
|
631
653
|
|
|
632
654
|
/**
|
|
633
655
|
* The sentence `implicit-integrations` adds for dependencies whose manifest
|
|
634
|
-
* could not be loaded, or '' when there are none. Still informational:
|
|
635
|
-
*
|
|
636
|
-
*
|
|
656
|
+
* could not be loaded, or '' when there are none. Still informational: a
|
|
657
|
+
* broken install (a package the dependency requires is missing) is also that
|
|
658
|
+
* package's integration issue (INV14), and anything else is the dependency's
|
|
659
|
+
* own bug, which `doctor integration validate` diagnoses; either way doctor
|
|
660
|
+
* must not report it as absent.
|
|
637
661
|
* @param {Array<{spec: string, error: string}>} failures
|
|
638
662
|
* @returns {string}
|
|
639
663
|
*/
|
|
@@ -1006,6 +1030,69 @@ export function checkIntegrationIssues(ctx) {
|
|
|
1006
1030
|
};
|
|
1007
1031
|
}
|
|
1008
1032
|
|
|
1033
|
+
/**
|
|
1034
|
+
* Every loaded integration's `@astryxdesign/core` peer range admits the
|
|
1035
|
+
* installed Core: a package's declared peer ranges define the Core versions it
|
|
1036
|
+
* supports (spec:AST-017 FR12). A package made for another Core installs with
|
|
1037
|
+
* only a package manager warning, and its components, themes and docs may not
|
|
1038
|
+
* work. New, so it warns: a project that passed before keeps passing.
|
|
1039
|
+
* Packages of added themes are left to `theme-core-peers` (spec:AST-050 FR11),
|
|
1040
|
+
* which applies the same rule. Null when Core is not installed or no other
|
|
1041
|
+
* loaded integration declares a Core range.
|
|
1042
|
+
* @param {DoctorContext} ctx
|
|
1043
|
+
* @returns {DoctorCheck | null}
|
|
1044
|
+
*/
|
|
1045
|
+
export function checkIntegrationCoreRange(ctx) {
|
|
1046
|
+
const core = pkgVersion(ctx.coreDir);
|
|
1047
|
+
if (!core || ctx.integrations == null) return null;
|
|
1048
|
+
// `theme-core-peers` already judges each added theme package by the same
|
|
1049
|
+
// rule (`corePeerRange`), with a fix that keeps the theme setup working.
|
|
1050
|
+
const reportedByThemeChecks = new Set(ctx.addedThemePackages ?? []);
|
|
1051
|
+
/** @type {Array<{name: string, version: string | null, range: string, accepts: boolean}>} */
|
|
1052
|
+
const declared = [];
|
|
1053
|
+
for (const integration of ctx.integrations) {
|
|
1054
|
+
if (integration.__loadError != null || !integration.__packageDir) continue;
|
|
1055
|
+
const pkg = readPkg(path.join(integration.__packageDir, 'package.json'));
|
|
1056
|
+
const name = typeof pkg?.name === 'string' ? pkg.name : integration.name;
|
|
1057
|
+
if (reportedByThemeChecks.has(name)) continue;
|
|
1058
|
+
const {range, accepts} = corePeerRange(pkg, core);
|
|
1059
|
+
// An integration need not depend on Core; only a declared, non-empty range
|
|
1060
|
+
// is a claim about which Core it supports.
|
|
1061
|
+
if (range == null || range === '') continue;
|
|
1062
|
+
declared.push({
|
|
1063
|
+
name,
|
|
1064
|
+
version: typeof pkg?.version === 'string' ? pkg.version : null,
|
|
1065
|
+
range,
|
|
1066
|
+
accepts,
|
|
1067
|
+
});
|
|
1068
|
+
}
|
|
1069
|
+
if (declared.length === 0) return null;
|
|
1070
|
+
const excluded = declared.filter(d => !d.accepts);
|
|
1071
|
+
const label = 'Integrations support the installed Core';
|
|
1072
|
+
if (excluded.length === 0) {
|
|
1073
|
+
return {
|
|
1074
|
+
id: 'integration-core-range',
|
|
1075
|
+
label,
|
|
1076
|
+
status: 'pass',
|
|
1077
|
+
message: `${declared.length} loaded integration${declared.length === 1 ? ' supports' : 's support'} @astryxdesign/core ${core} (${nameIntegrations(declared)}).`,
|
|
1078
|
+
};
|
|
1079
|
+
}
|
|
1080
|
+
return {
|
|
1081
|
+
id: 'integration-core-range',
|
|
1082
|
+
label,
|
|
1083
|
+
status: 'warn',
|
|
1084
|
+
message: `${excluded
|
|
1085
|
+
.map(
|
|
1086
|
+
d =>
|
|
1087
|
+
`${d.name}${d.version ? `@${d.version}` : ''} supports @astryxdesign/core ${d.range}`,
|
|
1088
|
+
)
|
|
1089
|
+
.join(
|
|
1090
|
+
'; ',
|
|
1091
|
+
)}, but the project has ${core}. ${excluded.length === 1 ? 'Its' : 'Their'} components, themes and docs were made for another Core and may not work.`,
|
|
1092
|
+
fix: `Install a release of ${excluded.length === 1 ? 'that package' : 'each package'} whose @astryxdesign/core range includes ${core}, or move the project to a Core in that range. When no such release exists, ask the package's owner for one.`,
|
|
1093
|
+
};
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1009
1096
|
/**
|
|
1010
1097
|
* The project's icon sets (AST-084 FR17). Fails when `experimental.iconSet`
|
|
1011
1098
|
* names a set, main or backup, that is not installed, that is installed but
|
|
@@ -1061,11 +1148,34 @@ export function checkIconSets(ctx) {
|
|
|
1061
1148
|
fix: 'Write each name in experimental.iconSet as "<package>/<set>" (`astryx experimental icon --list` names them).',
|
|
1062
1149
|
};
|
|
1063
1150
|
}
|
|
1151
|
+
// The look a project picks is one of its main set's variants.
|
|
1152
|
+
const declared = choice.set?.data.variants ?? [];
|
|
1153
|
+
if (choice.set && choice.variant && !declared.includes(choice.variant)) {
|
|
1154
|
+
return {
|
|
1155
|
+
id,
|
|
1156
|
+
label,
|
|
1157
|
+
status: 'fail',
|
|
1158
|
+
message:
|
|
1159
|
+
declared.length === 0
|
|
1160
|
+
? `experimental.iconVariant names "${choice.variant}", but the main set ${choice.configured} declares no variants: it draws one look.`
|
|
1161
|
+
: `experimental.iconVariant names "${choice.variant}", but the main set ${choice.configured} declares no such variant. Its variants: ${declared.join(', ')}.`,
|
|
1162
|
+
fix:
|
|
1163
|
+
declared.length === 0
|
|
1164
|
+
? `Remove experimental.iconVariant: run \`${iconUseCommandOf(choice)}\`.`
|
|
1165
|
+
: `Pick one of its variants: \`${iconUseCommandOf(choice, '<variant>')}\`.`,
|
|
1166
|
+
};
|
|
1167
|
+
}
|
|
1064
1168
|
const order = choice.order ?? [];
|
|
1065
1169
|
const unlisted = sets.filter(set => !order.includes(set));
|
|
1066
1170
|
if (sets.length > 1 && unlisted.length > 0 && order.length > 0) {
|
|
1067
1171
|
const [main, ...backups] = order;
|
|
1068
|
-
const {problem, fix} = unlistedIconSets(
|
|
1172
|
+
const {problem, fix} = unlistedIconSets(
|
|
1173
|
+
sets,
|
|
1174
|
+
main,
|
|
1175
|
+
backups,
|
|
1176
|
+
unlisted,
|
|
1177
|
+
choice.variant,
|
|
1178
|
+
);
|
|
1069
1179
|
return {
|
|
1070
1180
|
id,
|
|
1071
1181
|
label,
|
|
@@ -1087,10 +1197,24 @@ export function checkIconSets(ctx) {
|
|
|
1087
1197
|
id,
|
|
1088
1198
|
label,
|
|
1089
1199
|
status: 'pass',
|
|
1090
|
-
message: `${sets.length} icon set${sets.length === 1 ? '' : 's'} installed. ${choice.reason}`,
|
|
1200
|
+
message: `${sets.length} icon set${sets.length === 1 ? '' : 's'} installed. ${choice.reason}${choice.variant ? ` Each icon draws its "${choice.variant}" look where its set has one.` : ''}`,
|
|
1091
1201
|
};
|
|
1092
1202
|
}
|
|
1093
1203
|
|
|
1204
|
+
/**
|
|
1205
|
+
* The `experimental icon use` command that writes the project's list again,
|
|
1206
|
+
* as astryx.config names it, with a variant when one is given.
|
|
1207
|
+
* @param {NonNullable<DoctorContext['iconSets']>['choice']} choice
|
|
1208
|
+
* @param {string} [variant]
|
|
1209
|
+
*/
|
|
1210
|
+
function iconUseCommandOf(choice, variant) {
|
|
1211
|
+
return iconUseCommand(
|
|
1212
|
+
/** @type {string} */ (choice.configured),
|
|
1213
|
+
(choice.backups ?? []).map(each => each.selector),
|
|
1214
|
+
variant,
|
|
1215
|
+
);
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1094
1218
|
/**
|
|
1095
1219
|
* The placeholder component for a missing icon, still in the project's own
|
|
1096
1220
|
* source (AST-084): each file and the meanings it stands for, with the commands that give each a
|
|
@@ -1123,7 +1247,12 @@ export function checkIconPlaceholders(ctx) {
|
|
|
1123
1247
|
)
|
|
1124
1248
|
.join(', ');
|
|
1125
1249
|
const uses = found.reduce((total, each) => total + each.uses, 0);
|
|
1126
|
-
const [mapFix, backupFix] = placeholderFixes(
|
|
1250
|
+
const [mapFix, backupFix] = placeholderFixes(
|
|
1251
|
+
meanings,
|
|
1252
|
+
main,
|
|
1253
|
+
(choice.backups ?? []).map(each => each.selector),
|
|
1254
|
+
choice.variant,
|
|
1255
|
+
);
|
|
1127
1256
|
return {
|
|
1128
1257
|
id,
|
|
1129
1258
|
label,
|
|
@@ -2193,7 +2322,7 @@ export function checkGatherCache() {
|
|
|
2193
2322
|
id: 'gather-cache',
|
|
2194
2323
|
label: 'Kept catalog cache',
|
|
2195
2324
|
status: 'info',
|
|
2196
|
-
message: `search, build, component, template, theme, discover and doctor keep what they gather (search's catalogs, each integration's check results, and doctor's docs checks) in ${summary.dir} (${summary.entries} ${summary.entries === 1 ? 'entry' : 'entries'}, ${size})${summary.pnp ? ", but not in a run under Yarn Plug'n'Play's loader, such as `yarn astryx`, which gathers every time" : ''}; each is used only while nothing it read has changed, and deleting the folder clears it.`,
|
|
2325
|
+
message: `search, build, component, template, theme, discover, docs and doctor keep what they gather (search's catalogs, each integration's check results, template discovery's records, integrations' theme records, and doctor's docs checks) in ${summary.dir} (${summary.entries} ${summary.entries === 1 ? 'entry' : 'entries'}, ${size})${summary.pnp ? ", but not in a run under Yarn Plug'n'Play's loader, such as `yarn astryx`, which gathers every time" : ''}; each is used only while nothing it read has changed, and deleting the folder clears it.`,
|
|
2197
2326
|
};
|
|
2198
2327
|
}
|
|
2199
2328
|
|
|
@@ -2211,6 +2340,7 @@ export const SYNC_CHECKS = [
|
|
|
2211
2340
|
checkConfiguredIntegrations,
|
|
2212
2341
|
checkProviderIdentity,
|
|
2213
2342
|
checkIntegrationIssues,
|
|
2343
|
+
checkIntegrationCoreRange,
|
|
2214
2344
|
checkIconSets,
|
|
2215
2345
|
checkIconPlaceholders,
|
|
2216
2346
|
checkAgentDocs,
|
|
@@ -2401,6 +2531,7 @@ export async function runChecks(options = {}) {
|
|
|
2401
2531
|
coreDir,
|
|
2402
2532
|
ownCli: projectHasOwnCli(cwd),
|
|
2403
2533
|
projectCore: projectCoreVersion(cwd),
|
|
2534
|
+
addedThemePackages: addedThemePackages(cwd),
|
|
2404
2535
|
configPath,
|
|
2405
2536
|
integrations,
|
|
2406
2537
|
docsCatalog,
|