@astryxdesign/cli 0.7.2-canary.9c7c665 → 0.7.2-canary.9e97808
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/discover/_adapter.d.mts +119 -12
- package/api/discover/_adapter.mjs +449 -10
- package/api/discover/_adapter.test.mjs +599 -17
- package/api/discover/_catalog-view.d.mts +16 -5
- package/api/discover/_catalog-view.mjs +32 -8
- package/api/discover/discover.d.mts +11 -0
- package/api/discover/discover.doc.mjs +7 -6
- package/api/discover/discover.mjs +107 -19
- package/api/discover/discover.type.d.mts +18 -7
- package/api/discover/discover.type.mjs +15 -7
- package/api/discover/list/list.d.mts +4 -3
- package/api/discover/list/list.mjs +17 -10
- package/assets/discover/official-packages.json +367 -0
- package/authoring/discover/discover.doc.mjs +1 -1
- package/clients/cli/commands/discover.broken-integration.test.mjs +4 -1
- package/clients/cli/commands/discover.doc.mjs +1 -1
- package/clients/cli/commands/discover.mjs +144 -93
- package/clients/cli/commands/discover.no-source.test.mjs +447 -33
- package/clients/cli/commands/discover.sources.test.mjs +20 -1
- package/clients/cli/commands/json-contract.test.mjs +5 -1
- package/foundation/response/response-types.doc.mjs +1 -1
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -437,7 +437,7 @@ Every response has a `type` discriminant. The full set is below (generated from
|
|
|
437
437
|
| `docs.node` | 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). |
|
|
438
438
|
| `blog.list` | The feed URL plus every post parsed from the RSS feed, each with slug, title, description, date, type, authors, link, and plaintext URL. |
|
|
439
439
|
| `blog.detail` | One post's metadata plus the feed URL and the post's full plaintext body. |
|
|
440
|
-
| `discover.list` |
|
|
440
|
+
| `discover.list` | What the project has, the integrations it loads and the official packages it declares, official packages first (name, category, components, version, a list per other kind they add, and latest when a source knows it); meta.available lists what the project could add, the official packages first, each with the command that adds it, and meta.sources reports each source, the official list last; when it lists no integration it carries meta.configured to tell "nothing configured" from "nothing discovered". |
|
|
441
441
|
| `discover.detail` | One package, for an @scope/name or @scope/name@version query: what the shown version adds, whether the project has it, and, when a source knows the package, its versions, latest release, and the command that adds it. |
|
|
442
442
|
| `discover.detail.doc` | The validated ComponentDoc for one installed component, for an @scope/name/Component query. |
|
|
443
443
|
| `discover.item` | One item that is not an installed component, for an @scope/name/<item> query: its kind, name, package, version, and whether the project has the package. |
|
|
@@ -42,13 +42,28 @@ export function hasSources(project: Project | undefined): boolean;
|
|
|
42
42
|
* @returns {Set<string>}
|
|
43
43
|
*/
|
|
44
44
|
export function declaredDependencies(project: Project | undefined): Set<string>;
|
|
45
|
+
/**
|
|
46
|
+
* What the project's own package.json, the nearest one above the folder
|
|
47
|
+
* discover runs in, declares among the official packages.
|
|
48
|
+
* @param {Project | undefined} project
|
|
49
|
+
* @param {OfficialPackage[]} official
|
|
50
|
+
* @returns {OfficialDeclarations}
|
|
51
|
+
*/
|
|
52
|
+
export function officialDeclarations(project: Project | undefined, official: OfficialPackage[]): OfficialDeclarations;
|
|
45
53
|
/**
|
|
46
54
|
* The command that adds a package with the project's package manager. Discover
|
|
47
|
-
* only prints it; it never runs it.
|
|
55
|
+
* only prints it; it never runs it. Asked for one version, it adds that
|
|
56
|
+
* version. Given the official list, it otherwise pins an official package to
|
|
57
|
+
* what its entry names (spec:AST-051 FR2): the project's Core version or
|
|
58
|
+
* declared Core range, else the latest release. A range is quoted, because
|
|
59
|
+
* `^`, `<`, `>`, `|` and spaces mean something to a shell.
|
|
48
60
|
* @param {Project | undefined} project
|
|
61
|
+
* @param {{official?: OfficialPackage[]}} [options]
|
|
49
62
|
* @returns {(name: string, version?: string) => string}
|
|
50
63
|
*/
|
|
51
|
-
export function addCommand(project: Project | undefined
|
|
64
|
+
export function addCommand(project: Project | undefined, { official }?: {
|
|
65
|
+
official?: OfficialPackage[];
|
|
66
|
+
}): (name: string, version?: string) => string;
|
|
52
67
|
/**
|
|
53
68
|
* The per-user cache directory the saved copies live in, never inside a
|
|
54
69
|
* project. Standard platform locations only.
|
|
@@ -56,15 +71,17 @@ export function addCommand(project: Project | undefined): (name: string, version
|
|
|
56
71
|
*/
|
|
57
72
|
export function defaultCacheDir(): string;
|
|
58
73
|
/**
|
|
59
|
-
* Call every discover source
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
74
|
+
* Call every discover source (see {@link callOwnSources}), then read the
|
|
75
|
+
* official list (spec:AST-051 FR11). The list comes last, so a source keeps
|
|
76
|
+
* its entry for an official package, or for any package of the same
|
|
77
|
+
* integration (FR7); the list adds the official packages no source covers.
|
|
78
|
+
* The result stays in source order; discover puts official packages first
|
|
79
|
+
* only where it shows them ({@link officialFirst}).
|
|
63
80
|
*
|
|
64
81
|
* @param {Project | undefined} project
|
|
65
|
-
* @param {{package?: string, version?: string}} [request]
|
|
66
|
-
*
|
|
67
|
-
*
|
|
82
|
+
* @param {{package?: string, version?: string}} [request]
|
|
83
|
+
* @param {{cacheDir?: string, timeoutMs?: number, official?: OfficialList}} [options]
|
|
84
|
+
* `official`: the list {@link officialList} read; read here when absent
|
|
68
85
|
* @returns {Promise<CatalogResult>}
|
|
69
86
|
*/
|
|
70
87
|
export function callSources(project: Project | undefined, request?: {
|
|
@@ -73,7 +90,62 @@ export function callSources(project: Project | undefined, request?: {
|
|
|
73
90
|
}, options?: {
|
|
74
91
|
cacheDir?: string;
|
|
75
92
|
timeoutMs?: number;
|
|
93
|
+
official?: OfficialList;
|
|
76
94
|
}): Promise<CatalogResult>;
|
|
95
|
+
/**
|
|
96
|
+
* Official packages first, in the official list's order; the rest keep theirs.
|
|
97
|
+
* @template T
|
|
98
|
+
* @param {T[]} items
|
|
99
|
+
* @param {OfficialPackage[]} official
|
|
100
|
+
* @param {(item: T) => string} nameOf
|
|
101
|
+
* @returns {T[]}
|
|
102
|
+
*/
|
|
103
|
+
export function officialFirst<T>(items: T[], official: OfficialPackage[], nameOf: (item: T) => string): T[];
|
|
104
|
+
/**
|
|
105
|
+
* The official list this CLI carries (spec:AST-051 FR11). The file holds no
|
|
106
|
+
* versions; each entry takes them from this CLI and the project:
|
|
107
|
+
*
|
|
108
|
+
* - Its latest release is the newest release this CLI knows: its own version
|
|
109
|
+
* on a release CLI, or the project's Core version when that is a newer
|
|
110
|
+
* release.
|
|
111
|
+
* - A package released with Core lists a release CLI's own version and the
|
|
112
|
+
* project's Core version (installed, else declared exactly), so each,
|
|
113
|
+
* the latest release included, can be looked up. Its add command pins the project's Core version, else the Core range
|
|
114
|
+
* the project declares, else the latest release; nothing on a canary CLI in
|
|
115
|
+
* a project with no Core, which may have been published without it.
|
|
116
|
+
* - A canary-only package is listed only by a canary CLI, as a prerelease at
|
|
117
|
+
* the project's Core version when that is a prerelease, else at the CLI's
|
|
118
|
+
* own version when the project has no Core. It is not listed beside a
|
|
119
|
+
* released or declared Core, which it cannot be installed with.
|
|
120
|
+
*
|
|
121
|
+
* @param {{file?: string, version?: string, project?: Project}} [options] the
|
|
122
|
+
* list file and the CLI version to read it for, both defaulting to this
|
|
123
|
+
* CLI's own, and the project whose Core decides the versions
|
|
124
|
+
* @returns {OfficialList}
|
|
125
|
+
*/
|
|
126
|
+
export function officialList({ file, version, project, }?: {
|
|
127
|
+
file?: string;
|
|
128
|
+
version?: string;
|
|
129
|
+
project?: Project;
|
|
130
|
+
}): OfficialList;
|
|
131
|
+
/**
|
|
132
|
+
* What the project has: its installed integrations plus each official package
|
|
133
|
+
* its own package.json declares as a dependency whose entry the official list
|
|
134
|
+
* supplied, official packages first. A declared official package that a source
|
|
135
|
+
* lists stays as that source shows it (FR7). One that failed to load as an
|
|
136
|
+
* integration stays out. A declared one takes what it adds from the list and
|
|
137
|
+
* its version from the copy the project installed, under an npm alias too.
|
|
138
|
+
*
|
|
139
|
+
* @param {Project | undefined} project
|
|
140
|
+
* @param {InstalledPackage[]} installed from {@link describeInstalled}
|
|
141
|
+
* @param {CatalogResult} catalog
|
|
142
|
+
* @param {OfficialDeclarations} declared from {@link officialDeclarations}
|
|
143
|
+
* @param {OfficialPackage[]} official the official list, for the order
|
|
144
|
+
* @returns {Array<InstalledPackage & {declaredOfficial?: true}>}
|
|
145
|
+
*/
|
|
146
|
+
export function withDeclaredOfficial(project: Project | undefined, installed: InstalledPackage[], catalog: CatalogResult, declared: OfficialDeclarations, official: OfficialPackage[]): Array<InstalledPackage & {
|
|
147
|
+
declaredOfficial?: true;
|
|
148
|
+
}>;
|
|
77
149
|
/**
|
|
78
150
|
* Project a scanned or installed package into the discover list/detail entry
|
|
79
151
|
* shape. Shared by the list and detail leaves so the entry keys (and their
|
|
@@ -104,11 +176,43 @@ export function loadValidatedDoc(result: ComponentResolution, { lang, zh }: {
|
|
|
104
176
|
lang?: string | null;
|
|
105
177
|
zh?: boolean;
|
|
106
178
|
}): Promise<import("./discover.type.mjs").DiscoverDetailDocResponse["data"]>;
|
|
179
|
+
/** The name the official list goes by, as a source and on each of its entries. */
|
|
180
|
+
export const OFFICIAL_SOURCE_NAME: "Astryx";
|
|
181
|
+
/** The official list, generated from the repository when the CLI is built. */
|
|
182
|
+
export const OFFICIAL_LIST_FILE: string;
|
|
107
183
|
/** The list and detail entry fields for each item kind, in display order. */
|
|
108
184
|
export const KIND_FIELDS: readonly [readonly ["component", "components"], readonly ["template", "templates"], readonly ["doc", "docs"], readonly ["theme", "themes"], readonly ["codemod", "codemods"], readonly ["agent-doc", "agentDocs"]];
|
|
109
185
|
export type ScannedPackage = import("./_package-scanner.mjs").ScannedPackage;
|
|
110
186
|
export type DiscoverPackage = import("../../authoring/discover/type").DiscoverPackage;
|
|
111
187
|
export type DiscoverSource = import("../../authoring/discover/type").DiscoverSource;
|
|
188
|
+
/**
|
|
189
|
+
* An official package as this CLI lists it (spec:AST-051 FR11), with what its
|
|
190
|
+
* add command pins (FR2): the project's Core version, the Core range the
|
|
191
|
+
* project declares, or the latest release; with none, it pins nothing.
|
|
192
|
+
*/
|
|
193
|
+
export type OfficialPackage = DiscoverPackage & {
|
|
194
|
+
pin?: string;
|
|
195
|
+
};
|
|
196
|
+
/**
|
|
197
|
+
* The official packages the project's package.json declares: the real package
|
|
198
|
+
* name of each, mapped to the name it is installed under (an npm alias such as
|
|
199
|
+
* `"my-theme": "npm:@astryxdesign/theme-gothic@0.7.0"` installs under
|
|
200
|
+
* `my-theme`). `dependency` holds those declared in dependencies,
|
|
201
|
+
* devDependencies or optionalDependencies, which make a package the project's
|
|
202
|
+
* own; `any` adds peerDependencies, which only keep it from being offered.
|
|
203
|
+
*/
|
|
204
|
+
export type OfficialDeclarations = {
|
|
205
|
+
dependency: Map<string, string>;
|
|
206
|
+
any: Set<string>;
|
|
207
|
+
};
|
|
208
|
+
/**
|
|
209
|
+
* The official list as this CLI reads it. `error` says why the file could not
|
|
210
|
+
* be read; the list is then empty and discover reports it like a failed source.
|
|
211
|
+
*/
|
|
212
|
+
export type OfficialList = {
|
|
213
|
+
packages: OfficialPackage[];
|
|
214
|
+
error?: string;
|
|
215
|
+
};
|
|
112
216
|
/**
|
|
113
217
|
* An installed integration with what it adds, per kind. `components` is the
|
|
114
218
|
* scanned component list the discover leaves have always used.
|
|
@@ -129,7 +233,8 @@ export type SourceState = {
|
|
|
129
233
|
*/
|
|
130
234
|
name: string;
|
|
131
235
|
/**
|
|
132
|
-
* `astryx.config`,
|
|
236
|
+
* `astryx.config`, the integration that exports it, or
|
|
237
|
+
* `@astryxdesign/cli` for the official list
|
|
133
238
|
*/
|
|
134
239
|
from: string;
|
|
135
240
|
status: "fresh" | "saved" | "failed";
|
|
@@ -145,13 +250,15 @@ export type SourceState = {
|
|
|
145
250
|
error?: string | undefined;
|
|
146
251
|
};
|
|
147
252
|
/**
|
|
148
|
-
* Everything every source returned, merged
|
|
149
|
-
* package, the earlier source's entry is kept.
|
|
253
|
+
* Everything every source returned, merged, the official list last. When two
|
|
254
|
+
* sources list the same package, the earlier source's entry is kept. `official`
|
|
255
|
+
* marks an entry the official list supplied.
|
|
150
256
|
*/
|
|
151
257
|
export type CatalogResult = {
|
|
152
258
|
sources: SourceState[];
|
|
153
259
|
packages: Array<DiscoverPackage & {
|
|
154
260
|
source: string;
|
|
261
|
+
official?: true;
|
|
155
262
|
}>;
|
|
156
263
|
};
|
|
157
264
|
/**
|