aontu 0.67.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/dist/aontu.d.ts CHANGED
@@ -23,7 +23,7 @@ import { loadProfile } 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.67.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.67.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
@@ -76,10 +76,13 @@ type Servers = {
76
76
  };
77
77
  declare function serveUntilInterrupted(): Promise<void>;
78
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;
79
82
  declare function runExplain(argv: string[]): number;
80
83
  declare function runInit(argv: string[]): number;
81
84
  declare const KNOWN_VERBS: string[];
82
85
  declare function looksLikeVerb(arg: string): boolean;
83
86
  declare function nearestVerb(word: string, verbs: string[]): string;
84
87
  declare function main(argv: string[], servers?: Servers): void;
85
- 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, 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
@@ -28,6 +28,9 @@ exports.runHelp = runHelp;
28
28
  exports.runExplain = runExplain;
29
29
  exports.runInit = runInit;
30
30
  exports.nearestVerb = nearestVerb;
31
+ exports.explainBody = explainBody;
32
+ exports.noTextMark = noTextMark;
33
+ exports.canonExplainCode = canonExplainCode;
31
34
  exports.looksLikeVerb = looksLikeVerb;
32
35
  exports.runWhy = runWhy;
33
36
  exports.renderWhyText = renderWhyText;
@@ -4346,6 +4349,14 @@ function runHelp(argv) {
4346
4349
  // exported; a code that extends one is registered through its prefix
4347
4350
  // and carries that prefix's hint.
4348
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
+ }
4349
4360
  function explainCode(code) {
4350
4361
  const cls = (0, hints_1.codeClass)(code);
4351
4362
  let hint = hints_1.hints[code] ?? '';
@@ -4379,16 +4390,27 @@ function explainListText(format) {
4379
4390
  codes: codes.map((code) => ({
4380
4391
  code,
4381
4392
  class: (0, hints_1.codeClass)(code),
4382
- // Whether this port carries explanation text for the code. The
4383
- // registry is in parity; the hint tables are not, so a consumer
4384
- // that wants only explained codes can filter rather than guess.
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.
4385
4397
  explained: '' !== explainCode(code).hint,
4386
4398
  })),
4387
4399
  }, 2);
4388
4400
  }
4389
4401
  const width = codes.reduce((w, c) => Math.max(w, c.length), 0);
4390
4402
  return codes.map((c) => c.padEnd(width) + ' ' + (0, hints_1.codeClass)(c) +
4391
- ('' === explainCode(c).hint ? ' (no text)' : '')).join('\n');
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)' : '';
4392
4414
  }
4393
4415
  function runExplain(argv) {
4394
4416
  let format = 'text';
@@ -4431,7 +4453,7 @@ function runExplain(argv) {
4431
4453
  process.stderr.write(`aontu: explain needs one code\n${EXPLAIN_HELP}\n`);
4432
4454
  return 2;
4433
4455
  }
4434
- const code = codes[0];
4456
+ const code = canonExplainCode(codes[0]);
4435
4457
  const { cls, hint, registered } = explainCode(code);
4436
4458
  if (!registered) {
4437
4459
  // AN UNKNOWN CODE IS A USAGE ERROR AND NAMES NEAR MATCHES. A
@@ -4455,13 +4477,7 @@ function runExplain(argv) {
4455
4477
  }, 2) + '\n');
4456
4478
  return 0;
4457
4479
  }
4458
- // A REGISTERED CODE WITH NO HINT SAYS SO rather than printing an
4459
- // empty block, which would read as an explanation that happened to
4460
- // be blank.
4461
- const body = '' === hint
4462
- ? '(no explanation text is registered for this code)'
4463
- : hint;
4464
- process.stdout.write(`code: ${code}\nclass: ${cls}\n\n${body}\n`);
4480
+ process.stdout.write(`code: ${code}\nclass: ${cls}\n\n${explainBody(hint)}\n`);
4465
4481
  return 0;
4466
4482
  }
4467
4483
  const INIT_HELP = 'aontu init [dir] (try --help)';
@@ -4731,5 +4747,5 @@ function main(argv, servers = SERVERS) {
4731
4747
  else {
4732
4748
  runStdin(mode, format, trust).then((code) => finish(code));
4733
4749
  }
4734
- } /* node:coverage ignore next 21 */
4750
+ } /* node:coverage ignore next 22 */
4735
4751
  //# sourceMappingURL=cli.js.map