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