@dialecte/cli 0.3.1 → 0.5.0
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 +878 -137
- package/dist/cli.js +36667 -17536
- package/dist/ignorers.js +11 -0
- package/dist/lookups.d.ts +143 -8
- package/dist/lookups.js +445 -197
- package/package.json +47 -2
package/dist/ignorers.js
CHANGED
|
@@ -19,6 +19,17 @@ var STRYKER_VALIDATION_SCHEMA = {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
|
+
var MUTANTS_USAGE_LINES = [
|
|
23
|
+
"usage: dialecte mutants run [--mode changed|audit] [--base <ref>]",
|
|
24
|
+
" dialecte mutants status [--json]",
|
|
25
|
+
" dialecte mutants schedule <follow-up> <survivor key>... | schedule <follow-up> --all-new [--json]",
|
|
26
|
+
" dialecte mutants abandon <run id> [--json]",
|
|
27
|
+
" dialecte mutants migrate [--json]",
|
|
28
|
+
" dialecte mutants judge [--file <file>] [--json]",
|
|
29
|
+
" dialecte mutants record (--key <survivor key>... | --file <file>) --family <family> --reason <text> [--removable] [--json]",
|
|
30
|
+
" dialecte mutants drop <run id> [--json]"
|
|
31
|
+
];
|
|
32
|
+
var MUTANTS_USAGE = MUTANTS_USAGE_LINES.join("\n");
|
|
22
33
|
|
|
23
34
|
// src/lib/mutation/ignorers.ts
|
|
24
35
|
function ignoreReason(params) {
|
package/dist/lookups.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AnyDialecteConfig } from '@dialecte/core';
|
|
2
|
-
import { resolveDefinition, getAttributeRules, enumeratedValues, valuePatterns, admittedXsiTypes, childOccurrences, orderByConfigSequence } from '@dialecte/core/utils';
|
|
2
|
+
import { ChildOccurrences, resolveDefinition, getAttributeRules, enumeratedValues, valuePatterns, admittedXsiTypes, childOccurrences, orderByConfigSequence } from '@dialecte/core/utils';
|
|
3
3
|
|
|
4
4
|
/** The roots a method hangs from: a read on `q` (`doc.query`), a write on `tx`, the document, the project. */
|
|
5
5
|
declare const ROOTS: readonly ["q", "tx", "doc", "project"];
|
|
@@ -43,18 +43,61 @@ type ApiJson = {
|
|
|
43
43
|
methods: ApiMethod[];
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
declare const printedBrand: unique symbol;
|
|
47
|
+
/**
|
|
48
|
+
* A text the cli may print, every line escaped once (or JSON): only `textOf` and `jsonOf` return one, so a command that
|
|
49
|
+
* builds its output another way does not type-check. A plain string at run time.
|
|
50
|
+
* @intent tell a text the cli escaped from a raw one, print a lookup's answer as it is
|
|
51
|
+
*/
|
|
52
|
+
type PrintedText = string & {
|
|
53
|
+
readonly [printedBrand]: true;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* What a lookup command answers inside the cli: the text it prints, built by the print boundary only, and its exit
|
|
58
|
+
* code (0 answer, 1 nothing found, 2 usage). Assignable to the public `LookupOutput`.
|
|
59
|
+
*/
|
|
47
60
|
type CommandOutput = {
|
|
61
|
+
output: PrintedText;
|
|
62
|
+
exitCode: 0 | 1 | 2;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* What a lookup answers, as `@dialecte/cli/lookups` exports it (`CommandOutput` there): the text the command would
|
|
66
|
+
* print, already escaped, and its exit code (0 answer, 1 nothing found, 2 usage). A plain string, so a program that
|
|
67
|
+
* serves the lookups in another form can build one of its own.
|
|
68
|
+
* @intent read a lookup's answer, serve a lookup in another form, build a lookup answer
|
|
69
|
+
*/
|
|
70
|
+
type LookupOutput = {
|
|
48
71
|
output: string;
|
|
49
72
|
exitCode: 0 | 1 | 2;
|
|
50
73
|
};
|
|
51
74
|
|
|
75
|
+
/**
|
|
76
|
+
* What `dialecte api <find|show> ...` prints for `argv` (the words after `api`) run in `cwd`: the methods found for a
|
|
77
|
+
* need, or one method's contract, read from the `api.json` of the installed packages; the usage with exit code 2 on
|
|
78
|
+
* a bad call.
|
|
79
|
+
*
|
|
80
|
+
* @intent answer an api lookup without the command line, find a Dialecte method by what it is for, show a method's contract from another program
|
|
81
|
+
*/
|
|
52
82
|
declare function runApi(params: {
|
|
53
83
|
argv: readonly string[];
|
|
54
84
|
cwd: string;
|
|
55
85
|
}): CommandOutput;
|
|
86
|
+
/**
|
|
87
|
+
* The packages an api lookup searched, as its not-found answer names them: their names joined by commas, or the line
|
|
88
|
+
* that says no installed package ships an `api.json`.
|
|
89
|
+
*
|
|
90
|
+
* @intent name the packages an api lookup searched, word a not-found api answer
|
|
91
|
+
*/
|
|
56
92
|
declare function packagesText(indexes: readonly ApiJson[]): string;
|
|
57
93
|
|
|
94
|
+
/**
|
|
95
|
+
* What `dialecte doctor` prints for `argv` run in `cwd`: each check of the installed `@dialecte/*` packages, their
|
|
96
|
+
* skills, the local checkouts (`dialecteRoot`) and the cli, ✅, ⚠️ or ❌ with the command that fixes it, exit 1 when a
|
|
97
|
+
* check is not ok; with `--brief`, one line per problem, nothing when in sync, always exit 0.
|
|
98
|
+
*
|
|
99
|
+
* @intent check a Dialecte install without the command line, tell whether the installed packages and their skills are in sync
|
|
100
|
+
*/
|
|
58
101
|
declare function runDoctor(params: {
|
|
59
102
|
argv: readonly string[];
|
|
60
103
|
cwd: string;
|
|
@@ -95,18 +138,27 @@ type MemberEntriesRead = {
|
|
|
95
138
|
output: CommandOutput;
|
|
96
139
|
};
|
|
97
140
|
|
|
98
|
-
/**
|
|
141
|
+
/**
|
|
142
|
+
* The method entries of the live types the expression is read from, or the answer that says why not.
|
|
143
|
+
*
|
|
144
|
+
* @intent read the live members of a package without the command line, get the method entries a members lookup answers from
|
|
145
|
+
*/
|
|
99
146
|
declare function readMemberEntries(params: {
|
|
100
147
|
argv: string[];
|
|
101
148
|
cwd: string;
|
|
102
149
|
}): MemberEntriesRead;
|
|
103
150
|
|
|
104
|
-
/**
|
|
151
|
+
/**
|
|
152
|
+
* What `dialecte models` prints for `argv` run in `cwd`, and the warning lines for stderr (an unknown or disagreeing
|
|
153
|
+
* vendor in the manifests).
|
|
154
|
+
*
|
|
155
|
+
* @intent learn which model a tier means without the command line, map the fast, standard, strong and frontier tiers to the project's vendor
|
|
156
|
+
*/
|
|
105
157
|
declare function runModels(params: {
|
|
106
158
|
argv: readonly string[];
|
|
107
159
|
cwd: string;
|
|
108
160
|
}): CommandOutput & {
|
|
109
|
-
warnings:
|
|
161
|
+
warnings: PrintedText;
|
|
110
162
|
};
|
|
111
163
|
|
|
112
164
|
/**
|
|
@@ -128,6 +180,49 @@ type LoadedDialecte = {
|
|
|
128
180
|
packageName: string;
|
|
129
181
|
config: AnyDialecteConfig;
|
|
130
182
|
readers: CoreReaders;
|
|
183
|
+
/** The standard the dialecte implements (`dialecte.standard` of its package.json); undefined when it names none. */
|
|
184
|
+
standard?: string | undefined;
|
|
185
|
+
};
|
|
186
|
+
type ChildDescription = {
|
|
187
|
+
tag: string;
|
|
188
|
+
} & ChildOccurrences;
|
|
189
|
+
type AttributeDescription = {
|
|
190
|
+
name: string;
|
|
191
|
+
required: boolean;
|
|
192
|
+
identityField: boolean;
|
|
193
|
+
default: string | undefined;
|
|
194
|
+
fixed: string | undefined;
|
|
195
|
+
/** The namespace of a foreign attribute (`xml:lang`); undefined for the element's own. */
|
|
196
|
+
namespace: string | undefined;
|
|
197
|
+
type: string | undefined;
|
|
198
|
+
enumeration: readonly string[];
|
|
199
|
+
patterns: readonly string[];
|
|
200
|
+
};
|
|
201
|
+
/** What `dialecte schema <Tag>` answers for one dialecte. */
|
|
202
|
+
type ElementDescription = {
|
|
203
|
+
packageName: string;
|
|
204
|
+
tag: string;
|
|
205
|
+
namespace: string;
|
|
206
|
+
parents: readonly string[];
|
|
207
|
+
children: ChildDescription[];
|
|
208
|
+
/** A wildcard admits elements of other namespaces too. */
|
|
209
|
+
anyChild: boolean;
|
|
210
|
+
attributes: AttributeDescription[];
|
|
211
|
+
/** Text content: its type, `string` when untyped; undefined when the element holds no text. */
|
|
212
|
+
text: string | undefined;
|
|
213
|
+
xsiTypes: readonly string[];
|
|
214
|
+
/**
|
|
215
|
+
* The declared type's Clark name; undefined when the declaration is anonymous, and on the unresolved union of a
|
|
216
|
+
* tag declared several ways unless its tag level names one.
|
|
217
|
+
*/
|
|
218
|
+
type: string | undefined;
|
|
219
|
+
documentation: string | undefined;
|
|
220
|
+
/** The key of the declaration described; undefined for a tag declared once and for the unresolved union. */
|
|
221
|
+
declaration: string | undefined;
|
|
222
|
+
/** How many ways the schema declares the tag (1 when declared once). */
|
|
223
|
+
declarations: number;
|
|
224
|
+
/** The description is of the one declaration that applies; false when it is the tag level (the union). */
|
|
225
|
+
resolved: boolean;
|
|
131
226
|
};
|
|
132
227
|
/** The dialectes found from a folder, and the packages built on core that could not be read, with why. */
|
|
133
228
|
type LoadedDialectes = {
|
|
@@ -142,6 +237,8 @@ type LoadedDialectes = {
|
|
|
142
237
|
type SchemaDialectesRead = {
|
|
143
238
|
kind: 'dialectes';
|
|
144
239
|
tagName: string;
|
|
240
|
+
/** The parent given with `--under`, when one was. */
|
|
241
|
+
under: string | undefined;
|
|
145
242
|
/** Those the `--package` filter keeps. */
|
|
146
243
|
loaded: LoadedDialectes;
|
|
147
244
|
/** The package filter, when one was given. */
|
|
@@ -153,12 +250,21 @@ type SchemaDialectesRead = {
|
|
|
153
250
|
output: CommandOutput;
|
|
154
251
|
};
|
|
155
252
|
|
|
156
|
-
/**
|
|
253
|
+
/**
|
|
254
|
+
* The dialectes (filtered by `--package`) the tag is looked up in, or the answer that says why not.
|
|
255
|
+
*
|
|
256
|
+
* @intent load the installed dialectes a schema lookup answers from, read an element's schema without the command line
|
|
257
|
+
*/
|
|
157
258
|
declare function readSchemaDialectes(params: {
|
|
158
259
|
argv: string[];
|
|
159
260
|
cwd: string;
|
|
160
261
|
}): Promise<SchemaDialectesRead>;
|
|
161
262
|
|
|
263
|
+
/**
|
|
264
|
+
* What `dialecte members <expression>` prints: the members one step below, or the closest ones one level up.
|
|
265
|
+
*
|
|
266
|
+
* @intent answer a members lookup from method entries already read, list what a doc.query or tx expression holds
|
|
267
|
+
*/
|
|
162
268
|
declare function answerMembers(params: {
|
|
163
269
|
entries: readonly MethodEntry[];
|
|
164
270
|
expression: string;
|
|
@@ -168,20 +274,49 @@ declare function answerMembers(params: {
|
|
|
168
274
|
/**
|
|
169
275
|
* Every `api.json` an agent can search from `cwd`: the package's own skills (inside a dialecte repository)
|
|
170
276
|
* and the skills of its installed dependencies, one per package, sorted by package name.
|
|
277
|
+
*
|
|
278
|
+
* @intent list the api indexes searchable from a folder, find which installed packages ship an api.json
|
|
171
279
|
*/
|
|
172
280
|
declare function readApiIndexes(params: {
|
|
173
281
|
cwd: string;
|
|
174
282
|
}): ApiJson[];
|
|
175
283
|
|
|
176
|
-
/**
|
|
284
|
+
/**
|
|
285
|
+
* The `version` of the nearest package.json above `startFolder`; by default this file's folder (dist/ in the bundle,
|
|
286
|
+
* src/lib/ in the sources), so the cli's own version. Throws when no package.json is above it.
|
|
287
|
+
*
|
|
288
|
+
* @intent read the installed cli's version, read a package's version from the folder it runs in, report the version a program serves its lookups with
|
|
289
|
+
*/
|
|
177
290
|
declare function readCliVersion(params?: {
|
|
178
291
|
startFolder?: string;
|
|
179
292
|
}): string;
|
|
180
293
|
|
|
294
|
+
/**
|
|
295
|
+
* What `dialecte schema <Tag>` prints: one block per installed dialecte holding the tag, or the closest tags.
|
|
296
|
+
* A tag declared several ways prints the declaration its `--under` parent decides, else each declaration with
|
|
297
|
+
* the parents that hold it.
|
|
298
|
+
*
|
|
299
|
+
* @intent answer a schema lookup from dialectes already loaded, tell what an element may hold and where
|
|
300
|
+
*/
|
|
181
301
|
declare function answerSchema(params: {
|
|
182
302
|
loaded: LoadedDialectes;
|
|
183
303
|
tagName: string;
|
|
304
|
+
/** A parent (`--under`): answers the declaration(s) the tag has there. */
|
|
305
|
+
under?: string | undefined;
|
|
184
306
|
json: boolean;
|
|
185
307
|
}): CommandOutput;
|
|
186
308
|
|
|
187
|
-
|
|
309
|
+
/**
|
|
310
|
+
* What an element may hold and where: the declaration that applies under `parent`, or the tag level (the union of
|
|
311
|
+
* its declarations) when none is decided. Undefined for a tag the dialecte lacks, or a parent that does not hold it.
|
|
312
|
+
*
|
|
313
|
+
* @intent describe an element of an installed dialecte, tell what an element may hold under a parent
|
|
314
|
+
*/
|
|
315
|
+
declare function describeElement(params: {
|
|
316
|
+
dialecte: LoadedDialecte;
|
|
317
|
+
tagName: string;
|
|
318
|
+
/** The tag the element sits under; decides which declaration applies when the tag is declared several ways. */
|
|
319
|
+
parent?: string | undefined;
|
|
320
|
+
}): ElementDescription | undefined;
|
|
321
|
+
|
|
322
|
+
export { type ApiExportedFunction, type ApiJson, type ApiMethod, type ApiMethodFields, type ApiRootMethod, type AttributeDescription, type ChildDescription, type LookupOutput as CommandOutput, type ElementDescription, type LoadedDialecte, type MemberEntriesRead, type PrintedText, type SchemaDialectesRead, answerMembers, answerSchema, describeElement, packagesText, readApiIndexes, readCliVersion, readMemberEntries, readSchemaDialectes, runApi, runDoctor, runModels };
|