aontu 0.66.0 → 0.68.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 +4 -1
- package/dist/allow.js +2 -2
- package/dist/allow.js.map +1 -1
- package/dist/aontu.d.ts +1 -1
- package/dist/aontu.js +1 -1
- package/dist/cli.d.ts +5 -1
- package/dist/cli.js +155 -36
- package/dist/cli.js.map +1 -1
- package/dist/helpdoc.js +1 -1
- package/dist/helpdoc.js.map +1 -1
- package/dist/hints.js +144 -1
- package/dist/hints.js.map +1 -1
- package/dist/lang.js +46 -10
- package/dist/lang.js.map +1 -1
- package/dist/lsp.d.ts +1 -1
- package/dist/mcp-server.js +1 -1
- package/dist/mcp-server.js.map +1 -1
- package/dist/mcp.js +1 -1
- package/dist/mcp.js.map +1 -1
- package/dist/query.d.ts +1 -1
- package/dist/query.js +7 -9
- package/dist/query.js.map +1 -1
- package/dist/val/RefVal.js +18 -6
- package/dist/val/RefVal.js.map +1 -1
- package/dist/vet.d.ts +3 -1
- package/dist/vet.js +88 -13
- package/dist/vet.js.map +1 -1
- package/dist/view.js +2 -4
- package/dist/view.js.map +1 -1
- package/package.json +2 -2
- package/skill/error-codes.md +25 -1
- package/src/allow.ts +3 -3
- package/src/aontu.ts +1 -1
- package/src/cli.ts +175 -37
- package/src/helpdoc.ts +1 -1
- package/src/hints.ts +197 -1
- package/src/lang.ts +47 -10
- package/src/mcp-server.ts +1 -1
- package/src/mcp.ts +1 -1
- package/src/query.ts +8 -13
- package/src/tsconfig.json +2 -1
- package/src/val/RefVal.ts +18 -7
- package/src/vet.ts +100 -13
- package/src/view.ts +3 -7
- package/dist/tsconfig.tsbuildinfo +0 -1
package/README.md
CHANGED
|
@@ -75,8 +75,11 @@ the same thing in a Node agent harness and a Go gateway.
|
|
|
75
75
|
## Documentation
|
|
76
76
|
|
|
77
77
|
- [Documentation home](https://github.com/aontu-lang/aontu/blob/main/docs/index.md)
|
|
78
|
-
- [
|
|
78
|
+
- [Tutorials](https://github.com/aontu-lang/aontu/blob/main/docs/tutorial.md)
|
|
79
79
|
- [Language reference](https://github.com/aontu-lang/aontu/blob/main/docs/reference-language.md)
|
|
80
|
+
- [Generation reference](https://github.com/aontu-lang/aontu/blob/main/docs/reference-generation.md)
|
|
81
|
+
- [Functions reference](https://github.com/aontu-lang/aontu/blob/main/docs/reference-functions.md)
|
|
82
|
+
- [Error reference](https://github.com/aontu-lang/aontu/blob/main/docs/reference-errors.md)
|
|
80
83
|
- [API and CLI reference](https://github.com/aontu-lang/aontu/blob/main/docs/reference-api.md)
|
|
81
84
|
- [Agent skill](https://github.com/aontu-lang/aontu/blob/main/docs/skill/SKILL.md)
|
|
82
85
|
|
package/dist/allow.js
CHANGED
|
@@ -44,7 +44,7 @@ function readEntries(list, by, ctx) {
|
|
|
44
44
|
const text = true === el.isString ? el.peg : el.gen(ctx);
|
|
45
45
|
if (before < ctx.err.length) {
|
|
46
46
|
const err = ctx.err[before];
|
|
47
|
-
return { entries, finding:
|
|
47
|
+
return { entries, finding: (0, vet_1.engineFinding)(err, ctx, `${by}.${i}`) };
|
|
48
48
|
}
|
|
49
49
|
entries.push({ parts: (0, query_1.pathParts)(text), text, by: `${by}.${i}` });
|
|
50
50
|
}
|
|
@@ -99,7 +99,7 @@ function allow(src, role, paths, opts) {
|
|
|
99
99
|
}
|
|
100
100
|
const root = aontu.unify(new ConjunctVal_1.ConjunctVal({ peg: [model, shape] }, ctx), undefined, ctx);
|
|
101
101
|
if (0 < ctx.err.length || true === root.isNil) {
|
|
102
|
-
return errorReport(role, (0, query_1.evalFailure)(ctx));
|
|
102
|
+
return errorReport(role, (0, query_1.evalFailure)(ctx, root));
|
|
103
103
|
}
|
|
104
104
|
const roles = (0, vet_1.anchorAt)(root, at);
|
|
105
105
|
const atRole = `${at}.${role}`;
|
package/dist/allow.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"allow.js","sourceRoot":"","sources":["../src/allow.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} from './profile';
|
|
|
23
23
|
import { desugarTemplate, resugarTemplate, markerFor } from './template';
|
|
24
24
|
import { format, unifiedDiff } from './format';
|
|
25
25
|
export type { LintFinding, FormatReport, FormatOptions } from './format';
|
|
26
|
-
declare const VERSION = "0.
|
|
26
|
+
declare const VERSION = "0.68.0";
|
|
27
27
|
declare class Aontu {
|
|
28
28
|
opts: AontuOptions;
|
|
29
29
|
lang: Lang;
|
package/dist/aontu.js
CHANGED
|
@@ -58,7 +58,7 @@ Object.defineProperty(exports, "markerFor", { enumerable: true, get: function ()
|
|
|
58
58
|
const format_1 = require("./format");
|
|
59
59
|
Object.defineProperty(exports, "format", { enumerable: true, get: function () { return format_1.format; } });
|
|
60
60
|
Object.defineProperty(exports, "unifiedDiff", { enumerable: true, get: function () { return format_1.unifiedDiff; } });
|
|
61
|
-
const VERSION = '0.
|
|
61
|
+
const VERSION = '0.68.0';
|
|
62
62
|
exports.VERSION = VERSION;
|
|
63
63
|
function genQuiet(val, aontu) {
|
|
64
64
|
return val.gen(aontu.ctx({ collect: true }));
|
package/dist/cli.d.ts
CHANGED
|
@@ -49,6 +49,7 @@ declare function runPackageVerb(verb: string, argv: string[], servers: Servers):
|
|
|
49
49
|
declare function runModel(argv: string[]): number;
|
|
50
50
|
declare function runRelations(argv: string[]): number;
|
|
51
51
|
declare function runTrace(argv: string[]): number;
|
|
52
|
+
declare function renderSkipped(folder: string, since: number): string[];
|
|
52
53
|
declare function runRender(argv: string[]): Promise<number>;
|
|
53
54
|
declare function runReaches(argv: string[]): number;
|
|
54
55
|
declare function runView(argv: string[]): number;
|
|
@@ -75,10 +76,13 @@ type Servers = {
|
|
|
75
76
|
};
|
|
76
77
|
declare function serveUntilInterrupted(): Promise<void>;
|
|
77
78
|
declare function runHelp(argv: string[]): number;
|
|
79
|
+
declare function canonExplainCode(code: string): string;
|
|
80
|
+
declare function explainBody(hint: string): string;
|
|
81
|
+
declare function noTextMark(hint: string): string;
|
|
78
82
|
declare function runExplain(argv: string[]): number;
|
|
79
83
|
declare function runInit(argv: string[]): number;
|
|
80
84
|
declare const KNOWN_VERBS: string[];
|
|
81
85
|
declare function looksLikeVerb(arg: string): boolean;
|
|
82
86
|
declare function nearestVerb(word: string, verbs: string[]): string;
|
|
83
87
|
declare function main(argv: string[], servers?: Servers): void;
|
|
84
|
-
export { evalSource, main, runVet, runSubsume, runBreaking, runTrim, runRelations, runReaches, runView, runJsonSchema, runTemplate, runTrace, runRender, runPkg, runModel, runPackageVerb, pkgToolOptions, serveUntilInterrupted, runHash, runGet, runHelp, runExplain, runInit, nearestVerb, looksLikeVerb, KNOWN_VERBS, runWhy, renderWhyText, runSet, runAllow, runAgentsMd, runFmt, watchChange, watchSignature, vetWaiter, deprecatedAt, };
|
|
88
|
+
export { evalSource, main, runVet, runSubsume, runBreaking, runTrim, runRelations, runReaches, runView, runJsonSchema, runTemplate, runTrace, runRender, renderSkipped, runPkg, runModel, runPackageVerb, pkgToolOptions, serveUntilInterrupted, runHash, runGet, runHelp, runExplain, runInit, nearestVerb, explainBody, noTextMark, canonExplainCode, looksLikeVerb, KNOWN_VERBS, runWhy, renderWhyText, runSet, runAllow, runAgentsMd, runFmt, watchChange, watchSignature, vetWaiter, deprecatedAt, };
|
package/dist/cli.js
CHANGED
|
@@ -16,6 +16,7 @@ exports.runJsonSchema = runJsonSchema;
|
|
|
16
16
|
exports.runTemplate = runTemplate;
|
|
17
17
|
exports.runTrace = runTrace;
|
|
18
18
|
exports.runRender = runRender;
|
|
19
|
+
exports.renderSkipped = renderSkipped;
|
|
19
20
|
exports.runPkg = runPkg;
|
|
20
21
|
exports.runModel = runModel;
|
|
21
22
|
exports.runPackageVerb = runPackageVerb;
|
|
@@ -27,6 +28,9 @@ exports.runHelp = runHelp;
|
|
|
27
28
|
exports.runExplain = runExplain;
|
|
28
29
|
exports.runInit = runInit;
|
|
29
30
|
exports.nearestVerb = nearestVerb;
|
|
31
|
+
exports.explainBody = explainBody;
|
|
32
|
+
exports.noTextMark = noTextMark;
|
|
33
|
+
exports.canonExplainCode = canonExplainCode;
|
|
30
34
|
exports.looksLikeVerb = looksLikeVerb;
|
|
31
35
|
exports.runWhy = runWhy;
|
|
32
36
|
exports.renderWhyText = renderWhyText;
|
|
@@ -144,22 +148,30 @@ query between a document and its own earlier versions.
|
|
|
144
148
|
|
|
145
149
|
Options:
|
|
146
150
|
-c, --canon Print the canonical form instead of generated JSON
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
151
|
+
(the bare command's, as --jsonl is; model get has
|
|
152
|
+
its own)
|
|
153
|
+
--format <f> text (default) or json, on every verb that answers a
|
|
154
|
+
report. The json form is one object opening with an
|
|
155
|
+
aontu block; the bare command's carries findings, ok
|
|
156
|
+
and out
|
|
150
157
|
-h, --help Show this help and exit (the verbs and their flags);
|
|
151
158
|
aontu help is the LANGUAGE, and lists its own topics
|
|
152
159
|
--jsonl REPL: answer every command as one JSON line
|
|
153
160
|
-v, --version Print the version and exit
|
|
154
|
-
--trust <t> Include capability: system
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
161
|
+
--trust <t> Include capability: system, none, or root[:dir] to
|
|
162
|
+
confine @"..." below a directory. A bare root means
|
|
163
|
+
the entry root: the document's own directory, or the
|
|
164
|
+
project's for the package verbs. Every verb takes it
|
|
165
|
+
but help, explain, init and lsp, which read no
|
|
166
|
+
document, and mcp, which is the npm build's server
|
|
167
|
+
and confines with --root. Unset, a run behaves as
|
|
168
|
+
system, and the bare command warns once for an
|
|
169
|
+
include that leaves the entry root
|
|
158
170
|
--include-root <dir> Shorthand for --trust root:<dir>
|
|
159
|
-
--text-ext <e> Read these extensions as text too, comma-separated
|
|
160
|
-
|
|
171
|
+
--text-ext <e> Read these extensions as text too, comma-separated,
|
|
172
|
+
with or without dots (md,sql). .txt needs no flag; a
|
|
161
173
|
named format keeps its meaning, and .js stays
|
|
162
|
-
refused.
|
|
174
|
+
refused. The verbs that take --trust take it too
|
|
163
175
|
|
|
164
176
|
Package verbs (a module is imported; a package is published):
|
|
165
177
|
sync Make the project correct: resolve by minimum version
|
|
@@ -653,7 +665,7 @@ function takeTrust(argv, io = PROCESS_IO) {
|
|
|
653
665
|
}
|
|
654
666
|
else if ('--include-root' === arg) {
|
|
655
667
|
const dir = argv[++i];
|
|
656
|
-
if (null == dir) {
|
|
668
|
+
if (null == dir || '' === dir) {
|
|
657
669
|
io.err('aontu: --include-root needs a directory\n');
|
|
658
670
|
return undefined;
|
|
659
671
|
}
|
|
@@ -2292,20 +2304,38 @@ function pkgNetText(verb, report) {
|
|
|
2292
2304
|
}
|
|
2293
2305
|
const MODEL_HELP = 'aontu model get|why|set ... (try --help)';
|
|
2294
2306
|
// One document, interrogated or edited (ADR-039 part 5).
|
|
2307
|
+
// Where the subcommand is, past any global flag that precedes it.
|
|
2308
|
+
// `takeTrust` strips those anywhere in a tail, so the subcommand has
|
|
2309
|
+
// to be found past a flag AND past its value: in `--text-ext get` the
|
|
2310
|
+
// `get` is the extension list, not the subcommand.
|
|
2311
|
+
const MODEL_SUBS = ['get', 'why', 'set'];
|
|
2312
|
+
const GLOBAL_VALUED = ['--trust', '--include-root', '--text-ext'];
|
|
2313
|
+
function modelSubAt(argv) {
|
|
2314
|
+
for (let i = 0; i < argv.length; i++) {
|
|
2315
|
+
if (GLOBAL_VALUED.includes(argv[i])) {
|
|
2316
|
+
i++;
|
|
2317
|
+
continue;
|
|
2318
|
+
}
|
|
2319
|
+
return MODEL_SUBS.includes(argv[i]) ? i : -1;
|
|
2320
|
+
}
|
|
2321
|
+
return -1;
|
|
2322
|
+
}
|
|
2295
2323
|
function runModel(argv) {
|
|
2296
2324
|
const sub = argv[0];
|
|
2297
2325
|
if ('-h' === sub || '--help' === sub) {
|
|
2298
2326
|
process.stdout.write(HELP);
|
|
2299
2327
|
return 0;
|
|
2300
2328
|
}
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2329
|
+
const at = modelSubAt(argv);
|
|
2330
|
+
if (0 <= at) {
|
|
2331
|
+
const tail = argv.slice(0, at).concat(argv.slice(at + 1));
|
|
2332
|
+
if ('get' === argv[at]) {
|
|
2333
|
+
return runGet(tail);
|
|
2334
|
+
}
|
|
2335
|
+
if ('why' === argv[at]) {
|
|
2336
|
+
return runWhy(tail);
|
|
2337
|
+
}
|
|
2338
|
+
return runSet(tail);
|
|
2309
2339
|
}
|
|
2310
2340
|
process.stderr.write(`aontu: model needs get, why or set\n${MODEL_HELP}\n`);
|
|
2311
2341
|
return 2;
|
|
@@ -2488,6 +2518,62 @@ function generatorRuntime() {
|
|
|
2488
2518
|
function isDirectory(path) {
|
|
2489
2519
|
return true === (0, node_fs_1.statSync)(path, { throwIfNoEntry: false })?.isDirectory();
|
|
2490
2520
|
}
|
|
2521
|
+
// A `File` the write path skips, RENAMED rather than removed: dropping
|
|
2522
|
+
// the node would take its children's claims with it and hide drift the
|
|
2523
|
+
// write path does make. The skip is the File's own save alone, so what
|
|
2524
|
+
// separates the runs is its output path, composed by the runtime rather
|
|
2525
|
+
// than here.
|
|
2526
|
+
const EXCLUDED_NAME = '.aontu-check-excluded-';
|
|
2527
|
+
// `exclude` as the runtime reads it: `true`, or a string or list member
|
|
2528
|
+
// equal to the node's COMPONENT path, the chain of `name` props above
|
|
2529
|
+
// it, which a Project's `folder` is not part of. The Go runtime honours
|
|
2530
|
+
// the boolean alone, so the ports' `--check` answers differ for the
|
|
2531
|
+
// path forms (test/spec/divergent.tsv).
|
|
2532
|
+
function excludedFile(exclude, at) {
|
|
2533
|
+
if (true === exclude) {
|
|
2534
|
+
return true;
|
|
2535
|
+
}
|
|
2536
|
+
const path = at.join('/');
|
|
2537
|
+
if ('string' === typeof exclude) {
|
|
2538
|
+
return exclude === path;
|
|
2539
|
+
}
|
|
2540
|
+
return Array.isArray(exclude) && exclude.includes(path);
|
|
2541
|
+
}
|
|
2542
|
+
function renameExcluded(node, at, cut) {
|
|
2543
|
+
if (Array.isArray(node)) {
|
|
2544
|
+
return node.map((child) => renameExcluded(child, at, cut));
|
|
2545
|
+
}
|
|
2546
|
+
// A hand-written tree carries nodes with no `props` and nodes with
|
|
2547
|
+
// no `children`, and neither needs an arm of its own.
|
|
2548
|
+
const props = node.props ?? {};
|
|
2549
|
+
const below = 'string' === typeof props.name ? at.concat(props.name) : at;
|
|
2550
|
+
if ('File' === node.cmp && excludedFile(props.exclude, below)) {
|
|
2551
|
+
cut.push(1);
|
|
2552
|
+
return { ...node, props: { ...props, name: EXCLUDED_NAME + cut.length } };
|
|
2553
|
+
}
|
|
2554
|
+
if (!Array.isArray(node.children)) {
|
|
2555
|
+
return node;
|
|
2556
|
+
}
|
|
2557
|
+
return { ...node, children: renameExcluded(node.children, below, cut) };
|
|
2558
|
+
}
|
|
2559
|
+
// A file the runtime declined to touch, its copy on disk carrying the
|
|
2560
|
+
// protect marker, is in none of the lists it answers with: they hold
|
|
2561
|
+
// what was DONE to a file, and nothing was. The run's own record names
|
|
2562
|
+
// it. `since` drops what earlier runs left.
|
|
2563
|
+
function renderSkipped(folder, since) {
|
|
2564
|
+
const at = (0, node_path_1.join)(folder, '.jostraca', 'jostraca.meta.log');
|
|
2565
|
+
let meta;
|
|
2566
|
+
try {
|
|
2567
|
+
meta = JSON.parse((0, node_fs_1.readFileSync)(at, 'utf8'));
|
|
2568
|
+
}
|
|
2569
|
+
catch (err) {
|
|
2570
|
+
return [];
|
|
2571
|
+
}
|
|
2572
|
+
return Object.entries(meta?.files ?? {})
|
|
2573
|
+
.filter(([_, f]) => 'skip' === f?.action && since <= f?.when)
|
|
2574
|
+
.map(([path]) => path)
|
|
2575
|
+
.sort(keyorder_1.cmpCodePoint);
|
|
2576
|
+
}
|
|
2491
2577
|
async function runRender(argv) {
|
|
2492
2578
|
const trusted = takeTrust(argv);
|
|
2493
2579
|
if (null == trusted) {
|
|
@@ -2630,7 +2716,20 @@ async function runRender(argv) {
|
|
|
2630
2716
|
try {
|
|
2631
2717
|
if (check) {
|
|
2632
2718
|
const res = await runtime.check({ folder }, root);
|
|
2633
|
-
|
|
2719
|
+
let drift = res.drift.map((d) => ({ kind: d.kind, path: d.path }));
|
|
2720
|
+
// `--check` answers "would `render` change anything", so a file
|
|
2721
|
+
// the write path leaves alone is not held to the generator's
|
|
2722
|
+
// bytes. The skip is gated on the target BEING there -- `render`
|
|
2723
|
+
// writes an absent one -- so drift at a path with nothing at it
|
|
2724
|
+
// survives, which is the `missing` a deleted file reports.
|
|
2725
|
+
const cut = [];
|
|
2726
|
+
const renamed = renameExcluded(tree, [], cut);
|
|
2727
|
+
if (0 < cut.length) {
|
|
2728
|
+
const kept = new Set((await Jostraca().check({ folder }, cmpTree(renamed, { raw: true }))).checked);
|
|
2729
|
+
const skipped = new Set(res.checked.filter((p) => !kept.has(p)));
|
|
2730
|
+
drift = drift.filter((d) => !skipped.has(d.path) ||
|
|
2731
|
+
!(0, node_fs_1.existsSync)((0, node_path_1.join)(folder, d.path)));
|
|
2732
|
+
}
|
|
2634
2733
|
if ('json' === format) {
|
|
2635
2734
|
process.stdout.write((0, aontu_1.exactJSON)({
|
|
2636
2735
|
aontu: { version: version(), verb: 'render' },
|
|
@@ -2646,14 +2745,21 @@ async function runRender(argv) {
|
|
|
2646
2745
|
}
|
|
2647
2746
|
return 0 === drift.length ? 0 : 1;
|
|
2648
2747
|
}
|
|
2748
|
+
const since = Date.now();
|
|
2649
2749
|
const res = await runtime.generate({ folder }, root);
|
|
2750
|
+
const skipped = renderSkipped(folder, since);
|
|
2650
2751
|
if ('json' === format) {
|
|
2651
2752
|
process.stdout.write((0, aontu_1.exactJSON)({
|
|
2652
2753
|
aontu: { version: version(), verb: 'render' },
|
|
2653
2754
|
verdict: 'ok',
|
|
2654
|
-
files: res.files,
|
|
2755
|
+
files: { ...res.files, skipped },
|
|
2655
2756
|
}, 2) + '\n');
|
|
2656
2757
|
}
|
|
2758
|
+
else {
|
|
2759
|
+
for (const path of skipped) {
|
|
2760
|
+
process.stdout.write(`skipped: ${path}\n`);
|
|
2761
|
+
}
|
|
2762
|
+
}
|
|
2657
2763
|
return 0;
|
|
2658
2764
|
}
|
|
2659
2765
|
catch (err) {
|
|
@@ -3387,7 +3493,7 @@ function runHash(argv) {
|
|
|
3387
3493
|
const v = aontu.unify(src, { path: files[0] }, ctx);
|
|
3388
3494
|
if (0 < ctx.err.length || true === v?.isNil) {
|
|
3389
3495
|
process.stderr.write(`aontu: ${files[0]} does not evaluate on its own; nothing to hash\n` +
|
|
3390
|
-
renderFinding((0, query_1.evalFailure)(ctx)) + '\n');
|
|
3496
|
+
renderFinding((0, query_1.evalFailure)(ctx, v)) + '\n');
|
|
3391
3497
|
return 4;
|
|
3392
3498
|
}
|
|
3393
3499
|
const text = 'json' === format
|
|
@@ -4243,6 +4349,14 @@ function runHelp(argv) {
|
|
|
4243
4349
|
// exported; a code that extends one is registered through its prefix
|
|
4244
4350
|
// and carries that prefix's hint.
|
|
4245
4351
|
const EXPLAIN_PREFIXES = ['func:', 'op:', 'op[', 'var[', 'ref['];
|
|
4352
|
+
// A report prints the namespaced spelling in its brackets, which is the
|
|
4353
|
+
// span a reader copies. The answer names the registered one.
|
|
4354
|
+
const EXPLAIN_NAMESPACE = 'aontu/';
|
|
4355
|
+
function canonExplainCode(code) {
|
|
4356
|
+
return code.startsWith(EXPLAIN_NAMESPACE)
|
|
4357
|
+
? code.slice(EXPLAIN_NAMESPACE.length)
|
|
4358
|
+
: code;
|
|
4359
|
+
}
|
|
4246
4360
|
function explainCode(code) {
|
|
4247
4361
|
const cls = (0, hints_1.codeClass)(code);
|
|
4248
4362
|
let hint = hints_1.hints[code] ?? '';
|
|
@@ -4276,16 +4390,27 @@ function explainListText(format) {
|
|
|
4276
4390
|
codes: codes.map((code) => ({
|
|
4277
4391
|
code,
|
|
4278
4392
|
class: (0, hints_1.codeClass)(code),
|
|
4279
|
-
// Whether this port carries explanation text for the code.
|
|
4280
|
-
//
|
|
4281
|
-
//
|
|
4393
|
+
// Whether this port carries explanation text for the code. A
|
|
4394
|
+
// gate holds every registered code explained, so this reads
|
|
4395
|
+
// true throughout; it stays because the registry is
|
|
4396
|
+
// append-only and a consumer should filter rather than guess.
|
|
4282
4397
|
explained: '' !== explainCode(code).hint,
|
|
4283
4398
|
})),
|
|
4284
4399
|
}, 2);
|
|
4285
4400
|
}
|
|
4286
4401
|
const width = codes.reduce((w, c) => Math.max(w, c.length), 0);
|
|
4287
4402
|
return codes.map((c) => c.padEnd(width) + ' ' + (0, hints_1.codeClass)(c) +
|
|
4288
|
-
(
|
|
4403
|
+
noTextMark(explainCode(c).hint)).join('\n');
|
|
4404
|
+
}
|
|
4405
|
+
// The registry is append-only, so a code can be registered before its
|
|
4406
|
+
// text is written; saying so beats printing an empty block.
|
|
4407
|
+
function explainBody(hint) {
|
|
4408
|
+
return '' === hint
|
|
4409
|
+
? '(no explanation text is registered for this code)'
|
|
4410
|
+
: hint;
|
|
4411
|
+
}
|
|
4412
|
+
function noTextMark(hint) {
|
|
4413
|
+
return '' === hint ? ' (no text)' : '';
|
|
4289
4414
|
}
|
|
4290
4415
|
function runExplain(argv) {
|
|
4291
4416
|
let format = 'text';
|
|
@@ -4328,7 +4453,7 @@ function runExplain(argv) {
|
|
|
4328
4453
|
process.stderr.write(`aontu: explain needs one code\n${EXPLAIN_HELP}\n`);
|
|
4329
4454
|
return 2;
|
|
4330
4455
|
}
|
|
4331
|
-
const code = codes[0];
|
|
4456
|
+
const code = canonExplainCode(codes[0]);
|
|
4332
4457
|
const { cls, hint, registered } = explainCode(code);
|
|
4333
4458
|
if (!registered) {
|
|
4334
4459
|
// AN UNKNOWN CODE IS A USAGE ERROR AND NAMES NEAR MATCHES. A
|
|
@@ -4352,13 +4477,7 @@ function runExplain(argv) {
|
|
|
4352
4477
|
}, 2) + '\n');
|
|
4353
4478
|
return 0;
|
|
4354
4479
|
}
|
|
4355
|
-
|
|
4356
|
-
// empty block, which would read as an explanation that happened to
|
|
4357
|
-
// be blank.
|
|
4358
|
-
const body = '' === hint
|
|
4359
|
-
? '(no explanation text is registered for this code)'
|
|
4360
|
-
: hint;
|
|
4361
|
-
process.stdout.write(`code: ${code}\nclass: ${cls}\n\n${body}\n`);
|
|
4480
|
+
process.stdout.write(`code: ${code}\nclass: ${cls}\n\n${explainBody(hint)}\n`);
|
|
4362
4481
|
return 0;
|
|
4363
4482
|
}
|
|
4364
4483
|
const INIT_HELP = 'aontu init [dir] (try --help)';
|
|
@@ -4584,7 +4703,7 @@ function main(argv, servers = SERVERS) {
|
|
|
4584
4703
|
}
|
|
4585
4704
|
else if ('--include-root' === arg) {
|
|
4586
4705
|
const dir = args[++i];
|
|
4587
|
-
if (null == dir) {
|
|
4706
|
+
if (null == dir || '' === dir) {
|
|
4588
4707
|
process.stderr.write('aontu: --include-root needs a directory\n');
|
|
4589
4708
|
return finish(2);
|
|
4590
4709
|
}
|
|
@@ -4628,5 +4747,5 @@ function main(argv, servers = SERVERS) {
|
|
|
4628
4747
|
else {
|
|
4629
4748
|
runStdin(mode, format, trust).then((code) => finish(code));
|
|
4630
4749
|
}
|
|
4631
|
-
} /* node:coverage ignore next
|
|
4750
|
+
} /* node:coverage ignore next 22 */
|
|
4632
4751
|
//# sourceMappingURL=cli.js.map
|