@astryxdesign/cli 0.7.4-canary.3f6ea7d → 0.7.4-canary.88ec018
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 +63 -63
- package/api/docs/_adapter.d.mts +80 -0
- package/api/docs/_adapter.mjs +248 -5
- package/api/docs/detail/detail.mjs +8 -0
- package/api/docs/docs.doc.mjs +1 -1
- package/api/docs/docs.type.d.mts +28 -2
- package/api/docs/docs.type.mjs +13 -3
- package/api/docs/guide-route-targets.test.mjs +998 -0
- package/api/docs/index/index.mjs +9 -0
- package/api/docs/list/list.mjs +7 -1
- package/api/docs/node/node.mjs +9 -1
- package/api/doctor/built-checks.mjs +43 -13
- package/api/doctor/built-checks.test.mjs +29 -0
- package/api/doctor/doctor.doc.mjs +1 -1
- package/api/integration/_adapter.d.mts +8 -0
- package/api/integration/_adapter.mjs +25 -0
- package/api/integration/authoring-checks.mjs +29 -2
- package/api/integration/pack-check.mjs +32 -1
- package/api/integration/pack-check.test.mjs +33 -0
- package/api/integration/validate-integration.mjs +66 -1
- package/api/integration/validateIntegration.doc.mjs +1 -1
- package/api/search/_candidate-score.d.mts +3 -2
- package/api/search/_candidate-score.mjs +66 -3
- package/api/search/_gather-docs.mjs +12 -2
- package/api/search/_priority.mjs +2 -1
- package/api/search/_score.d.mts +2 -1
- package/api/search/_score.mjs +2 -2
- package/api/search/search.family-members.test.mjs +124 -0
- package/assets/discover/official-packages.json +16 -0
- package/assets/docs/tree/extend-or-replace.doc.mjs +36 -4
- package/assets/templates/themes/butter/butterPaletteRefs.generated.ts +54 -0
- package/assets/templates/themes/butter/butterPalettes.generated.receipt.json +1499 -0
- package/assets/templates/themes/butter/butterPalettes.generated.ts +550 -0
- package/assets/templates/themes/butter/butterTheme.ts +274 -234
- package/assets/templates/themes/butter/palette.config.json +484 -0
- package/assets/templates/themes/matcha/matchaPaletteRefs.generated.ts +51 -0
- package/assets/templates/themes/matcha/matchaPalettes.generated.receipt.json +1502 -0
- package/assets/templates/themes/matcha/matchaPalettes.generated.ts +501 -0
- package/assets/templates/themes/matcha/matchaPalettes.ts +21 -0
- package/assets/templates/themes/matcha/matchaTheme.ts +164 -103
- package/assets/templates/themes/matcha/palette.config.json +448 -0
- package/assets/templates/themes/y2k/palette.config.json +166 -0
- package/assets/templates/themes/y2k/y2kPaletteRefs.generated.ts +54 -0
- package/assets/templates/themes/y2k/y2kPalettes.generated.receipt.json +872 -0
- package/assets/templates/themes/y2k/y2kPalettes.generated.ts +550 -0
- package/assets/templates/themes/y2k/y2kPalettes.ts +257 -0
- package/assets/templates/themes/y2k/y2kTheme.ts +164 -391
- package/authoring/doctypes/_schema.d.mts +4 -0
- package/authoring/doctypes/_schema.mjs +4 -0
- package/authoring/doctypes/reference/type.ts +14 -2
- package/clients/cli/commands/docs.mjs +27 -2
- package/foundation/agent-docs/agent-docs.d.mts +14 -2
- package/foundation/agent-docs/agent-docs.mjs +54 -2
- package/foundation/agent-docs/agent-docs.test.mjs +61 -0
- package/foundation/discovery/docs-discovery.d.mts +93 -2
- package/foundation/discovery/docs-discovery.mjs +236 -8
- package/foundation/doc-compiler/compile.mjs +8 -1
- package/foundation/doc-compiler/doc-loads.test.mjs +3 -0
- package/foundation/doc-compiler/tree.d.mts +5 -0
- package/foundation/doc-compiler/tree.mjs +3 -0
- package/foundation/integrations/cli-requirement.d.mts +14 -0
- package/foundation/integrations/cli-requirement.mjs +23 -0
- package/foundation/integrations/cli-requirement.test.mjs +1 -0
- package/foundation/response/response-types.doc.mjs +5 -5
- package/package.json +9 -9
|
@@ -67,6 +67,29 @@ const INTEGRATION_DOC_SUFFIXES = ['.doc.ts', '.doc.mjs', '.doc.js'];
|
|
|
67
67
|
/** A topic name is a CLI argument and a URL segment; keep it to both. */
|
|
68
68
|
const TOPIC_NAME_RE = /^[\w-]+$/;
|
|
69
69
|
|
|
70
|
+
/**
|
|
71
|
+
* Whether a `replaces` or `extends` names a route of the docs tree rather than
|
|
72
|
+
* a flat topic: a topic name never holds a `/`, and a guide the tree places is
|
|
73
|
+
* always read by a route that does.
|
|
74
|
+
* @param {unknown} target
|
|
75
|
+
* @returns {target is string}
|
|
76
|
+
*/
|
|
77
|
+
export function isGuideRoute(target) {
|
|
78
|
+
return typeof target === 'string' && target.includes('/');
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* What the integrations do to one guide the docs tree places, in configured
|
|
83
|
+
* order: a replacement, and the extensions merged onto whatever is there.
|
|
84
|
+
* @typedef {object} GuideOverlay
|
|
85
|
+
* @property {DocsTopicRecord | null} replacement the doc readers get at the
|
|
86
|
+
* route instead of the guide; the last package configured wins
|
|
87
|
+
* @property {Array<{package: string, path: string, providerId?: string}>} extensions
|
|
88
|
+
* extensions authored after the replacement, if any, in configured order
|
|
89
|
+
* @property {string} [replacedPackage] the package of the replacement this one
|
|
90
|
+
* took over from, when the guide was replaced twice
|
|
91
|
+
*/
|
|
92
|
+
|
|
70
93
|
/**
|
|
71
94
|
* @typedef {object} DocsTopicRecord A doc file discovered under a docs root.
|
|
72
95
|
* @property {string} name
|
|
@@ -92,6 +115,8 @@ const TOPIC_NAME_RE = /^[\w-]+$/;
|
|
|
92
115
|
* @property {string} [description]
|
|
93
116
|
* @property {string|null} [category]
|
|
94
117
|
* @property {string} [replaces] the topic this one took the place of
|
|
118
|
+
* @property {string} [replacedPackage] the package whose topic or guide this
|
|
119
|
+
* one took the place of
|
|
95
120
|
* @property {Array<{package: string, path: string, providerId?: string}>} extensions
|
|
96
121
|
* overlays to merge onto the base doc, in the order their integrations were
|
|
97
122
|
* configured; each section an extension adds resolves its links against the
|
|
@@ -205,7 +230,21 @@ const BLOCK_FIELD_VALUES = {
|
|
|
205
230
|
const PROJECTION_FIELDS = ['fields', 'sections'];
|
|
206
231
|
|
|
207
232
|
/** Keys a section may carry. */
|
|
208
|
-
const SECTION_FIELDS = [
|
|
233
|
+
const SECTION_FIELDS = [
|
|
234
|
+
'id',
|
|
235
|
+
'title',
|
|
236
|
+
'category',
|
|
237
|
+
'content',
|
|
238
|
+
'previewType',
|
|
239
|
+
'before',
|
|
240
|
+
'after',
|
|
241
|
+
];
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* The fields an extension section places itself with: the key of the base
|
|
245
|
+
* section it goes before or after. Read only by a merge, never by a reader.
|
|
246
|
+
*/
|
|
247
|
+
export const SECTION_POSITION_FIELDS = ['before', 'after'];
|
|
209
248
|
|
|
210
249
|
/**
|
|
211
250
|
* Check the fields the docs surfaces actually read. `parseDoc` is the outer
|
|
@@ -265,6 +304,19 @@ export function problemsInTopic(doc, {placement = false} = {}) {
|
|
|
265
304
|
problems.push(`${at}.${key}: not a field of a section`);
|
|
266
305
|
}
|
|
267
306
|
}
|
|
307
|
+
for (const field of SECTION_POSITION_FIELDS) {
|
|
308
|
+
const value = section?.[field];
|
|
309
|
+
if (value != null && (typeof value !== 'string' || value === '')) {
|
|
310
|
+
problems.push(
|
|
311
|
+
`${at}.${field}: expected the key of a section, as \`--index\` shows it`,
|
|
312
|
+
);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
if (section?.before != null && section?.after != null) {
|
|
316
|
+
problems.push(
|
|
317
|
+
`${at}: sets both \`before\` and \`after\`; a section goes in one place`,
|
|
318
|
+
);
|
|
319
|
+
}
|
|
268
320
|
if (!Array.isArray(section?.content)) {
|
|
269
321
|
problems.push(`${at}.content: expected an array of blocks`);
|
|
270
322
|
return;
|
|
@@ -599,8 +651,9 @@ export async function discoverIntegrationDocs(integration) {
|
|
|
599
651
|
/**
|
|
600
652
|
* Merge an extension onto a base topic: a section with a stable `id` replaces
|
|
601
653
|
* the base section with the same `id`; legacy sections without IDs fall back to
|
|
602
|
-
* title matching. A section with no match is
|
|
603
|
-
*
|
|
654
|
+
* title matching. A section with no match is added: before or after the
|
|
655
|
+
* section whose key its `before` or `after` names, else at the end. The title
|
|
656
|
+
* and description stay the base topic's: an extension adds to a topic, it never
|
|
604
657
|
* renames it. A topic that `replaces` another is the one that renames.
|
|
605
658
|
*
|
|
606
659
|
* Keyed by section TITLE rather than by position, the way the localization
|
|
@@ -613,22 +666,123 @@ export async function discoverIntegrationDocs(integration) {
|
|
|
613
666
|
* @returns {any} a new doc; neither input is mutated
|
|
614
667
|
*/
|
|
615
668
|
export function mergeTopic(base, overlay) {
|
|
669
|
+
return mergeTopicReport(base, overlay).doc;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
/**
|
|
673
|
+
* {@link mergeTopic}, also naming each `before` or `after` that found no
|
|
674
|
+
* section: that section was added at the end instead.
|
|
675
|
+
*
|
|
676
|
+
* @param {any} base
|
|
677
|
+
* @param {any} overlay
|
|
678
|
+
* @returns {{doc: any, unplaced: Array<{section: string, field: 'before' | 'after', key: string}>}}
|
|
679
|
+
*/
|
|
680
|
+
export function mergeTopicReport(base, overlay) {
|
|
616
681
|
const sections = [...(base.sections ?? [])];
|
|
617
|
-
|
|
682
|
+
/** @type {Array<{section: string, field: 'before' | 'after', key: string}>} */
|
|
683
|
+
const unplaced = [];
|
|
684
|
+
|
|
685
|
+
for (const authored of overlay.sections ?? []) {
|
|
686
|
+
const section = withoutPosition(authored);
|
|
618
687
|
const at = findMergeTarget(sections, section);
|
|
619
688
|
if (at === -1) {
|
|
620
|
-
|
|
689
|
+
const field = authored.before != null ? 'before' : 'after';
|
|
690
|
+
const key = authored[field];
|
|
691
|
+
if (typeof key !== 'string') {
|
|
692
|
+
sections.push(section);
|
|
693
|
+
continue;
|
|
694
|
+
}
|
|
695
|
+
const anchor = sections.findIndex(
|
|
696
|
+
candidate => sectionKey(candidate) === key || candidate.id === key,
|
|
697
|
+
);
|
|
698
|
+
if (anchor === -1) {
|
|
699
|
+
unplaced.push({section: sectionKey(section), field, key});
|
|
700
|
+
sections.push(section);
|
|
701
|
+
} else if (field === 'before') {
|
|
702
|
+
// Placed just before a section another was placed `after`, it joins
|
|
703
|
+
// that section's group, so later sections placed there follow both.
|
|
704
|
+
if (sections[anchor][PLACED_AFTER] != null) {
|
|
705
|
+
Object.defineProperty(section, PLACED_AFTER, {
|
|
706
|
+
value: sections[anchor][PLACED_AFTER],
|
|
707
|
+
configurable: true,
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
sections.splice(anchor, 0, section);
|
|
711
|
+
} else {
|
|
712
|
+
// Sections placed after one key keep their order, across every
|
|
713
|
+
// extension merged onto the topic: each goes after every section
|
|
714
|
+
// placed there before it, and after the sections placed after those.
|
|
715
|
+
const group = new Set([key]);
|
|
716
|
+
let at = anchor + 1;
|
|
717
|
+
while (at < sections.length && group.has(sections[at][PLACED_AFTER])) {
|
|
718
|
+
group.add(sectionKey(sections[at]));
|
|
719
|
+
at += 1;
|
|
720
|
+
}
|
|
721
|
+
Object.defineProperty(section, PLACED_AFTER, {
|
|
722
|
+
value: key,
|
|
723
|
+
configurable: true,
|
|
724
|
+
});
|
|
725
|
+
sections.splice(at, 0, section);
|
|
726
|
+
}
|
|
621
727
|
} else {
|
|
622
728
|
// A legacy extension that replaces a section which has since gained a
|
|
623
|
-
// stable ID keeps that ID, so readers addressing it keep working.
|
|
729
|
+
// stable ID keeps that ID, so readers addressing it keep working. A
|
|
730
|
+
// replacing section keeps the place of the one it replaces.
|
|
624
731
|
const replaced = sections[at];
|
|
625
|
-
|
|
732
|
+
const replacing =
|
|
626
733
|
section.id == null && replaced.id != null
|
|
627
734
|
? withSourceTitle({...section, id: replaced.id}, sourceTitle(section))
|
|
628
735
|
: section;
|
|
736
|
+
// It also keeps the place an earlier `after` gave the one it replaces,
|
|
737
|
+
// so sections placed after that key later still follow it.
|
|
738
|
+
if (replaced[PLACED_AFTER] != null) {
|
|
739
|
+
const placed = replacing === section ? withoutPosition({...section}) : replacing;
|
|
740
|
+
for (const symbol of Object.getOwnPropertySymbols(section)) {
|
|
741
|
+
if (!(symbol in placed)) {
|
|
742
|
+
Object.defineProperty(
|
|
743
|
+
placed,
|
|
744
|
+
symbol,
|
|
745
|
+
/** @type {PropertyDescriptor} */ (
|
|
746
|
+
Object.getOwnPropertyDescriptor(section, symbol)
|
|
747
|
+
),
|
|
748
|
+
);
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
Object.defineProperty(placed, PLACED_AFTER, {
|
|
752
|
+
value: replaced[PLACED_AFTER],
|
|
753
|
+
configurable: true,
|
|
754
|
+
});
|
|
755
|
+
sections[at] = placed;
|
|
756
|
+
} else {
|
|
757
|
+
sections[at] = replacing;
|
|
758
|
+
}
|
|
629
759
|
}
|
|
630
760
|
}
|
|
631
|
-
return {...base, sections};
|
|
761
|
+
return {doc: {...base, sections}, unplaced};
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
/** The key a merged section was placed `after`, so later ones follow it. */
|
|
765
|
+
const PLACED_AFTER = Symbol('astryx.docs.placedAfter');
|
|
766
|
+
|
|
767
|
+
/**
|
|
768
|
+
* A section without the fields that place it; readers never see them.
|
|
769
|
+
* @param {any} section
|
|
770
|
+
* @returns {any}
|
|
771
|
+
*/
|
|
772
|
+
export function withoutPosition(section) {
|
|
773
|
+
if (section?.before == null && section?.after == null) return section;
|
|
774
|
+
const {before: _before, after: _after, ...rest} = section;
|
|
775
|
+
// Copy every own symbol (the provider and authored-title marks) too.
|
|
776
|
+
for (const symbol of Object.getOwnPropertySymbols(section)) {
|
|
777
|
+
Object.defineProperty(
|
|
778
|
+
rest,
|
|
779
|
+
symbol,
|
|
780
|
+
/** @type {PropertyDescriptor} */ (
|
|
781
|
+
Object.getOwnPropertyDescriptor(section, symbol)
|
|
782
|
+
),
|
|
783
|
+
);
|
|
784
|
+
}
|
|
785
|
+
return rest;
|
|
632
786
|
}
|
|
633
787
|
|
|
634
788
|
/**
|
|
@@ -723,6 +877,71 @@ export class DocsCatalog {
|
|
|
723
877
|
#treeInputs = [];
|
|
724
878
|
/** @type {Array<{package: string, message: string}>} */
|
|
725
879
|
#issues = [];
|
|
880
|
+
/** @type {Map<string, GuideOverlay>} lowercased route → what applies there */
|
|
881
|
+
#guideOverlays = new Map();
|
|
882
|
+
/** @type {DocsTopicRecord[]} every doc that targets a route, in order */
|
|
883
|
+
#guideTargeters = [];
|
|
884
|
+
|
|
885
|
+
/**
|
|
886
|
+
* Record a doc that replaces or extends a guide the docs tree places, by
|
|
887
|
+
* its route. Whether the route holds such a guide is known only once the
|
|
888
|
+
* tree is built: {@link guideOverlay} applies the record there, and a route
|
|
889
|
+
* that holds none applies nothing.
|
|
890
|
+
* @param {DocsTopicRecord} record
|
|
891
|
+
* @returns {import('../integrations/issue').AstryxIntegrationIssue | null}
|
|
892
|
+
*/
|
|
893
|
+
#targetGuide(record) {
|
|
894
|
+
const route = /** @type {string} */ (
|
|
895
|
+
record.replaces ?? record.extendsTopic
|
|
896
|
+
);
|
|
897
|
+
const key = route.toLowerCase();
|
|
898
|
+
const overlay = this.#guideOverlays.get(key) ?? {
|
|
899
|
+
replacement: null,
|
|
900
|
+
extensions: [],
|
|
901
|
+
};
|
|
902
|
+
if (record.replaces != null) {
|
|
903
|
+
const earlier = overlay.replacement;
|
|
904
|
+
if (earlier) {
|
|
905
|
+
// As with a flat topic, the later-configured doc wins, and reads name
|
|
906
|
+
// the replacement it took over from. Unlike a flat topic's, this is
|
|
907
|
+
// no warning: a new failing finding joins only in a minor release
|
|
908
|
+
// (architecture:cli-surface INV35); `integration validate` lists one
|
|
909
|
+
// package's two replacements of a guide as a note.
|
|
910
|
+
overlay.replacedPackage = earlier.package;
|
|
911
|
+
}
|
|
912
|
+
// Extensions were authored against the content that just went away.
|
|
913
|
+
overlay.replacement = record;
|
|
914
|
+
overlay.extensions = [];
|
|
915
|
+
} else {
|
|
916
|
+
overlay.extensions.push({
|
|
917
|
+
package: record.package,
|
|
918
|
+
path: record.path,
|
|
919
|
+
...(record.providerId ? {providerId: record.providerId} : {}),
|
|
920
|
+
});
|
|
921
|
+
}
|
|
922
|
+
this.#guideOverlays.set(key, overlay);
|
|
923
|
+
this.#guideTargeters.push(record);
|
|
924
|
+
return null;
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
/**
|
|
928
|
+
* What the integrations do to the guide the docs tree places at `route`, or
|
|
929
|
+
* null when they leave it as it is.
|
|
930
|
+
* @param {string} route
|
|
931
|
+
* @returns {GuideOverlay | null}
|
|
932
|
+
*/
|
|
933
|
+
guideOverlay(route) {
|
|
934
|
+
return this.#guideOverlays.get(route.toLowerCase()) ?? null;
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
/**
|
|
938
|
+
* Every doc that replaces or extends a guide by its route, in configured
|
|
939
|
+
* order, so a check can name a route that holds no guide.
|
|
940
|
+
* @returns {ReadonlyArray<DocsTopicRecord>}
|
|
941
|
+
*/
|
|
942
|
+
get guideTargeters() {
|
|
943
|
+
return this.#guideTargeters;
|
|
944
|
+
}
|
|
726
945
|
|
|
727
946
|
/**
|
|
728
947
|
* Record a doc file a package ships that did not load. Its package's docs
|
|
@@ -810,6 +1029,9 @@ export class DocsCatalog {
|
|
|
810
1029
|
add(record) {
|
|
811
1030
|
if (record.extendsTopic != null) {
|
|
812
1031
|
const target = this.resolve(record.extendsTopic);
|
|
1032
|
+
if (!target && isGuideRoute(record.extendsTopic)) {
|
|
1033
|
+
return this.#targetGuide(record);
|
|
1034
|
+
}
|
|
813
1035
|
if (!target) {
|
|
814
1036
|
return {
|
|
815
1037
|
code: 'invalid_doc',
|
|
@@ -827,6 +1049,9 @@ export class DocsCatalog {
|
|
|
827
1049
|
|
|
828
1050
|
if (record.replaces != null) {
|
|
829
1051
|
const target = this.resolve(record.replaces);
|
|
1052
|
+
if (!target && isGuideRoute(record.replaces)) {
|
|
1053
|
+
return this.#targetGuide(record);
|
|
1054
|
+
}
|
|
830
1055
|
if (!target) {
|
|
831
1056
|
return {
|
|
832
1057
|
code: 'invalid_doc',
|
|
@@ -859,6 +1084,9 @@ export class DocsCatalog {
|
|
|
859
1084
|
description: record.description,
|
|
860
1085
|
category: record.category,
|
|
861
1086
|
replaces: replaced,
|
|
1087
|
+
// The package whose topic it took over: an earlier replacement's, when
|
|
1088
|
+
// the topic was already replaced.
|
|
1089
|
+
replacedPackage: target.package,
|
|
862
1090
|
...(record.providerId ? {providerId: record.providerId} : {}),
|
|
863
1091
|
// Extensions were authored against the content that just went away.
|
|
864
1092
|
extensions: [],
|
|
@@ -23,7 +23,11 @@
|
|
|
23
23
|
|
|
24
24
|
import {parseTemplate} from '../../authoring/doctypes/template/parse.mjs';
|
|
25
25
|
import {parseTheme} from '../../authoring/doctypes/theme/parse.mjs';
|
|
26
|
-
import {
|
|
26
|
+
import {
|
|
27
|
+
mergeTopic,
|
|
28
|
+
problemsInTopic,
|
|
29
|
+
withoutPosition,
|
|
30
|
+
} from '../discovery/docs-discovery.mjs';
|
|
27
31
|
import {
|
|
28
32
|
sectionKey,
|
|
29
33
|
sectionKeyErrors,
|
|
@@ -179,6 +183,9 @@ export function lowerReferenceTopic(input) {
|
|
|
179
183
|
);
|
|
180
184
|
}
|
|
181
185
|
}
|
|
186
|
+
// `before` and `after` place an extension's sections while it merges; no
|
|
187
|
+
// read carries them, whether or not the doc extends anything.
|
|
188
|
+
doc = {...doc, sections: doc.sections.map(withoutPosition)};
|
|
182
189
|
// Derived keys are stamped only now, so they never take part in merging.
|
|
183
190
|
const keyed = withSectionKeys(doc);
|
|
184
191
|
/** @type {Record<string, string>} */
|
|
@@ -389,8 +389,11 @@ const LOADER_MODULES = {
|
|
|
389
389
|
'discoverIntegrationDocs',
|
|
390
390
|
'GRAPH_BLOCK_TYPES',
|
|
391
391
|
'GRAPH_ONLY_FIELDS',
|
|
392
|
+
'isGuideRoute',
|
|
392
393
|
'mergeTopic',
|
|
394
|
+
'mergeTopicReport',
|
|
393
395
|
'problemsInTopic',
|
|
396
|
+
'withoutPosition',
|
|
394
397
|
'withSourceTitle',
|
|
395
398
|
],
|
|
396
399
|
};
|
|
@@ -300,6 +300,11 @@ export type TreeNode = {
|
|
|
300
300
|
slots: TreeSlot[];
|
|
301
301
|
source: string;
|
|
302
302
|
ref?: any;
|
|
303
|
+
/**
|
|
304
|
+
* what integrations do to a guide the tree places, by its route: set by the
|
|
305
|
+
* project's tree, absent when nothing replaces or extends it
|
|
306
|
+
*/
|
|
307
|
+
guideOverlay?: import("../discovery/docs-discovery.mjs").GuideOverlay | undefined;
|
|
303
308
|
};
|
|
304
309
|
export type DocsTree = {
|
|
305
310
|
/**
|
|
@@ -178,6 +178,9 @@ export const topicLevel = category =>
|
|
|
178
178
|
* @property {TreeSlot[]} slots a namespace's slots; empty for a leaf
|
|
179
179
|
* @property {string} source
|
|
180
180
|
* @property {any} [ref]
|
|
181
|
+
* @property {import('../discovery/docs-discovery.mjs').GuideOverlay} [guideOverlay]
|
|
182
|
+
* what integrations do to a guide the tree places, by its route: set by the
|
|
183
|
+
* project's tree, absent when nothing replaces or extends it
|
|
181
184
|
*/
|
|
182
185
|
|
|
183
186
|
/**
|
|
@@ -56,6 +56,14 @@ export function componentReplacesCliProblem(pkg: any): string | null;
|
|
|
56
56
|
* @returns {string | null}
|
|
57
57
|
*/
|
|
58
58
|
export function sectionIdsCliProblem(pkg: any): string | null;
|
|
59
|
+
/**
|
|
60
|
+
* Why a package with a doc section that sets `before` or `after` would lose
|
|
61
|
+
* its doc topics on an older CLI, or null when its declared CLI range admits
|
|
62
|
+
* only CLIs that read the fields (spec:AST-046 FR11).
|
|
63
|
+
* @param {any} pkg package.json
|
|
64
|
+
* @returns {string | null}
|
|
65
|
+
*/
|
|
66
|
+
export function sectionPositionCliProblem(pkg: any): string | null;
|
|
59
67
|
/**
|
|
60
68
|
* Why a package that ships a theme would lose its themes and doc topics on an
|
|
61
69
|
* older CLI, or null when its declared CLI range admits only CLIs that read
|
|
@@ -140,3 +148,9 @@ export const THEMES_CLI: "0.6.4";
|
|
|
140
148
|
* published 0.6.4 reads the section by its id.
|
|
141
149
|
*/
|
|
142
150
|
export const SECTION_IDS_CLI: "0.6.4";
|
|
151
|
+
/**
|
|
152
|
+
* The first CLI release that reads a doc section's `before` and `after`.
|
|
153
|
+
* Earlier releases reject the fields and hide every doc topic the package
|
|
154
|
+
* ships.
|
|
155
|
+
*/
|
|
156
|
+
export const SECTION_POSITION_CLI: "0.7.4";
|
|
@@ -71,6 +71,13 @@ export const THEMES_CLI = '0.6.4';
|
|
|
71
71
|
*/
|
|
72
72
|
export const SECTION_IDS_CLI = '0.6.4';
|
|
73
73
|
|
|
74
|
+
/**
|
|
75
|
+
* The first CLI release that reads a doc section's `before` and `after`.
|
|
76
|
+
* Earlier releases reject the fields and hide every doc topic the package
|
|
77
|
+
* ships.
|
|
78
|
+
*/
|
|
79
|
+
export const SECTION_POSITION_CLI = '0.7.4';
|
|
80
|
+
|
|
74
81
|
const VERSION_RE = /^v?(\d+|[xX*])(?:\.(\d+|[xX*]))?(?:\.(\d+|[xX*]))?(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
75
82
|
|
|
76
83
|
/**
|
|
@@ -226,6 +233,22 @@ export function sectionIdsCliProblem(pkg) {
|
|
|
226
233
|
);
|
|
227
234
|
}
|
|
228
235
|
|
|
236
|
+
/**
|
|
237
|
+
* Why a package with a doc section that sets `before` or `after` would lose
|
|
238
|
+
* its doc topics on an older CLI, or null when its declared CLI range admits
|
|
239
|
+
* only CLIs that read the fields (spec:AST-046 FR11).
|
|
240
|
+
* @param {any} pkg package.json
|
|
241
|
+
* @returns {string | null}
|
|
242
|
+
*/
|
|
243
|
+
export function sectionPositionCliProblem(pkg) {
|
|
244
|
+
return cliRangeProblem(
|
|
245
|
+
pkg,
|
|
246
|
+
'has a doc section that sets `before` or `after`',
|
|
247
|
+
'rejects the fields, and can hide every doc topic the package ships',
|
|
248
|
+
SECTION_POSITION_CLI,
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
|
|
229
252
|
/**
|
|
230
253
|
* Why a package that ships a theme would lose its themes and doc topics on an
|
|
231
254
|
* older CLI, or null when its declared CLI range admits only CLIs that read
|
|
@@ -320,6 +320,7 @@ describe('every feature check names its CLI floor', () => {
|
|
|
320
320
|
replacesCliProblem: TEMPLATE_REPLACES_CLI,
|
|
321
321
|
keywordsCliProblem: KEYWORDS_CLI,
|
|
322
322
|
sectionIdsCliProblem: '0.6.4',
|
|
323
|
+
sectionPositionCliProblem: '0.7.4',
|
|
323
324
|
themesCliProblem: '0.6.4',
|
|
324
325
|
};
|
|
325
326
|
|
|
@@ -78,17 +78,17 @@ export const doc = {
|
|
|
78
78
|
{
|
|
79
79
|
value: 'docs.list',
|
|
80
80
|
description:
|
|
81
|
-
"All reference-doc topics as DocsListEntry[] ({topic, description, package, replaces?}), in read order; meta.namespaces lists the docs tree's top-level namespaces, and meta.notLoaded each package whose docs did not load.",
|
|
81
|
+
"All reference-doc topics as DocsListEntry[] ({topic, description, package, replaces?, replacedPackage?}), in read order; meta.namespaces lists the docs tree's top-level namespaces, and meta.notLoaded each package whose docs did not load.",
|
|
82
82
|
},
|
|
83
83
|
{
|
|
84
84
|
value: 'docs.detail',
|
|
85
85
|
description:
|
|
86
|
-
"One topic's full ReferenceDoc (the JSON read of a topic, --full, --dense, or a topic with one section), with token-ref blocks inlined and each section naming the package that wrote it, plus links ({up, previous, next}: the commands that open the level it sits in and its neighbors there).",
|
|
86
|
+
"One topic's full ReferenceDoc (the JSON read of a topic, --full, --dense, or a topic with one section), with token-ref blocks inlined and each section naming the package that wrote it, plus links ({up, previous, next}: the commands that open the level it sits in and its neighbors there). A topic or guide that took another's place carries replaces and replacedPackage, the package whose topic or guide it replaced.",
|
|
87
87
|
},
|
|
88
88
|
{
|
|
89
89
|
value: 'docs.index',
|
|
90
90
|
description:
|
|
91
|
-
"One topic's section index, the text read of a topic with more than one section (and --index): the topic's name, title, and description, plus sections, each {id, title, package, summary} (pass the id as the section argument; package is the npm package that wrote the section; summary is the section's one-line summary), and links ({up, previous, next}: the commands that open the level it sits in and its neighbors there).",
|
|
91
|
+
"One topic's section index, the text read of a topic with more than one section (and --index): the topic's name, title, and description, plus sections, each {id, title, package, summary} (pass the id as the section argument; package is the npm package that wrote the section; summary is the section's one-line summary), and links ({up, previous, next}: the commands that open the level it sits in and its neighbors there); replaces and replacedPackage when the topic or guide took another's place.",
|
|
92
92
|
},
|
|
93
93
|
{
|
|
94
94
|
value: 'docs.detail.section',
|
|
@@ -98,7 +98,7 @@ export const doc = {
|
|
|
98
98
|
{
|
|
99
99
|
value: 'docs.node',
|
|
100
100
|
description:
|
|
101
|
-
"One node of the docs tree, read by its route: its id, kind, package, title, summary, and breadcrumb, plus a namespace's slots with their children (one level down, each naming its package) or a typed doc's content, and links ({up, previous, next, related}: the commands that open its parent, its neighbors, and the docs it names).",
|
|
101
|
+
"One node of the docs tree, read by its route: its id, kind, package, title, summary, and breadcrumb, plus a namespace's slots with their children (one level down, each naming its package, and a guide an integration replaced its replaces and replacedPackage) or a typed doc's content, and links ({up, previous, next, related}: the commands that open its parent, its neighbors, and the docs it names).",
|
|
102
102
|
},
|
|
103
103
|
|
|
104
104
|
// blog (read from the published RSS feed)
|
|
@@ -338,7 +338,7 @@ export const doc = {
|
|
|
338
338
|
{
|
|
339
339
|
value: 'integration.validate',
|
|
340
340
|
description:
|
|
341
|
-
'The validation result: validated (false when nothing was validated: with no package.json the issues list carries one no_package error so the command exits 1, and with a package.json but no integration manifest the issues list is empty and proves nothing), the package name and version (both null when validated is false) plus issues, an AstryxIntegrationIssue[] of {code, severity: warning | error, message, fix?, file?, line?} (fix: the change that resolves it; file and line: where, relative to the package), and notes when there are any: {code, message} information that fails nothing, such as invalid_cli_command for a malformed cliCommand and cli_peer_version when the running CLI is outside the @astryxdesign/cli peer range of the package, and the package layout findings added after the last minor release, each with its fix in the message (duplicate_component_doc, symlinked_root, unreadable_file, invalid_package_json, no_provider_id, source_without_component_doc where a doc and its source still pair), and doc_name_mismatch and unknown_block_component, until they become warnings in the next minor release. A runner_command note lists each Astryx command a topic writes with a package runner (its file, line and the bare command to write). When the manifest loads, docTypes checks each doc against its published authoring type: status (checked | skipped), reason, typescript, docs, findings (all warnings, each naming the field and a fix), unchecked, and fixtures (test fixture docs not checked). When the manifest loads, docNames lists the component doc names it could not judge: status (checked), findings (always empty; a doc name the module its import names provably does not export is a doc_name_mismatch note, with its fix in the message) and unchecked ({file, name, reason}: a doc whose name differs from the name it is listed under and whose source exports cannot all be read, such as a re-export from another package). When the manifest loads, blockComponents lists the component names templates give in exampleFor or componentsUsed that could not be judged: status (checked), findings (always empty; a name neither the package nor Core has, and the template does not import, is an unknown_block_component note, with its fix in the message) and unchecked ({file, name, reason}: a name the template may reach through anything other than named imports and re-exports from Core, React, StyleX, local helpers or the entry of the package itself, such as an import from another package, a default or namespace import, an alias of or member read off an imported binding, require() or a dynamic import(), or a local module that cannot be read, or any name Core would have to resolve when Core is not installed). Since 0.7.3 each import apps cannot use is also a note (its fix in the message), listed only and failing --strict from the next minor. publicImports ({status: checked, findings: [], unchecked}) lists each import the check could not judge as {file, specifier, reason}; never counted or failed on.',
|
|
341
|
+
'The validation result: validated (false when nothing was validated: with no package.json the issues list carries one no_package error so the command exits 1, and with a package.json but no integration manifest the issues list is empty and proves nothing), the package name and version (both null when validated is false) plus issues, an AstryxIntegrationIssue[] of {code, severity: warning | error, message, fix?, file?, line?} (fix: the change that resolves it; file and line: where, relative to the package), and notes when there are any: {code, message} information that fails nothing, such as invalid_cli_command for a malformed cliCommand and cli_peer_version when the running CLI is outside the @astryxdesign/cli peer range of the package, and the package layout findings added after the last minor release, each with its fix in the message (duplicate_component_doc, symlinked_root, unreadable_file, invalid_package_json, no_provider_id, source_without_component_doc where a doc and its source still pair), and doc_name_mismatch and unknown_block_component, until they become warnings in the next minor release. A runner_command note lists each Astryx command a topic writes with a package runner (its file, line and the bare command to write). A doc_target_not_found note names a doc whose replaces or extends names no topic and no guide of the CLI docs or the docs of the package (such as a namespace), and a doc_section_unplaced note a section whose before or after names no section of what it extends (it is added at the end), and a duplicate_guide_replacement note two docs of the package that replace one guide; they become warnings in the next minor release. When the manifest loads, docTypes checks each doc against its published authoring type: status (checked | skipped), reason, typescript, docs, findings (all warnings, each naming the field and a fix), unchecked, and fixtures (test fixture docs not checked). When the manifest loads, docNames lists the component doc names it could not judge: status (checked), findings (always empty; a doc name the module its import names provably does not export is a doc_name_mismatch note, with its fix in the message) and unchecked ({file, name, reason}: a doc whose name differs from the name it is listed under and whose source exports cannot all be read, such as a re-export from another package). When the manifest loads, blockComponents lists the component names templates give in exampleFor or componentsUsed that could not be judged: status (checked), findings (always empty; a name neither the package nor Core has, and the template does not import, is an unknown_block_component note, with its fix in the message) and unchecked ({file, name, reason}: a name the template may reach through anything other than named imports and re-exports from Core, React, StyleX, local helpers or the entry of the package itself, such as an import from another package, a default or namespace import, an alias of or member read off an imported binding, require() or a dynamic import(), or a local module that cannot be read, or any name Core would have to resolve when Core is not installed). Since 0.7.3 each import apps cannot use is also a note (its fix in the message), listed only and failing --strict from the next minor. publicImports ({status: checked, findings: [], unchecked}) lists each import the check could not judge as {file, specifier, reason}; never counted or failed on.',
|
|
342
342
|
},
|
|
343
343
|
{
|
|
344
344
|
value: 'integration.template-conflicts',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/cli",
|
|
3
|
-
"version": "0.7.4-canary.
|
|
3
|
+
"version": "0.7.4-canary.88ec018",
|
|
4
4
|
"displayName": "CLI",
|
|
5
5
|
"description": "Scaffold projects, browse templates, generate themes, and get agent-ready docs from the command line.",
|
|
6
6
|
"author": "Meta Open Source",
|
|
@@ -106,10 +106,10 @@
|
|
|
106
106
|
"zod": "^4.4.3"
|
|
107
107
|
},
|
|
108
108
|
"peerDependencies": {
|
|
109
|
-
"@astryxdesign/charts": "0.7.4-canary.
|
|
110
|
-
"@astryxdesign/core": "0.7.4-canary.
|
|
111
|
-
"@astryxdesign/lab": "0.7.4-canary.
|
|
112
|
-
"@astryxdesign/theme-neutral": "0.7.4-canary.
|
|
109
|
+
"@astryxdesign/charts": "0.7.4-canary.88ec018",
|
|
110
|
+
"@astryxdesign/core": "0.7.4-canary.88ec018",
|
|
111
|
+
"@astryxdesign/lab": "0.7.4-canary.88ec018",
|
|
112
|
+
"@astryxdesign/theme-neutral": "0.7.4-canary.88ec018"
|
|
113
113
|
},
|
|
114
114
|
"peerDependenciesMeta": {
|
|
115
115
|
"@astryxdesign/charts": {
|
|
@@ -126,10 +126,10 @@
|
|
|
126
126
|
}
|
|
127
127
|
},
|
|
128
128
|
"devDependencies": {
|
|
129
|
-
"@astryxdesign/charts": "0.7.4-canary.
|
|
130
|
-
"@astryxdesign/core": "0.7.4-canary.
|
|
131
|
-
"@astryxdesign/lab": "0.7.4-canary.
|
|
132
|
-
"@astryxdesign/theme-neutral": "0.7.4-canary.
|
|
129
|
+
"@astryxdesign/charts": "0.7.4-canary.88ec018",
|
|
130
|
+
"@astryxdesign/core": "0.7.4-canary.88ec018",
|
|
131
|
+
"@astryxdesign/lab": "0.7.4-canary.88ec018",
|
|
132
|
+
"@astryxdesign/theme-neutral": "0.7.4-canary.88ec018",
|
|
133
133
|
"@heroicons/react": "^2.2.0",
|
|
134
134
|
"@stylexjs/stylex": "^0.19.0",
|
|
135
135
|
"@types/babel__core": "^7.20.5",
|