aontu 0.55.0 → 0.56.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 +3 -3
- package/dist/agentsmd.d.ts +1 -0
- package/dist/agentsmd.js +10 -3
- package/dist/agentsmd.js.map +1 -1
- package/dist/aontu.d.ts +3 -2
- package/dist/aontu.js +5 -2
- package/dist/aontu.js.map +1 -1
- package/dist/cli.d.ts +5 -2
- package/dist/cli.js +236 -49
- package/dist/cli.js.map +1 -1
- package/dist/diff.d.ts +1 -0
- package/dist/diff.js +3 -2
- package/dist/diff.js.map +1 -1
- package/dist/format.d.ts +17 -0
- package/dist/format.js +1000 -0
- package/dist/format.js.map +1 -0
- package/dist/hints.js +4 -0
- package/dist/hints.js.map +1 -1
- package/dist/jsonschema.d.ts +1 -0
- package/dist/jsonschema.js +3 -2
- package/dist/jsonschema.js.map +1 -1
- package/dist/lang.js +64 -5
- package/dist/lang.js.map +1 -1
- package/dist/lsp.d.ts +2 -1
- package/dist/lsp.js +1 -1
- package/dist/lsp.js.map +1 -1
- package/dist/mcp.js +6 -4
- package/dist/mcp.js.map +1 -1
- package/dist/patch.d.ts +1 -0
- package/dist/patch.js +1 -0
- package/dist/patch.js.map +1 -1
- package/dist/query.d.ts +1 -0
- package/dist/query.js +4 -3
- package/dist/query.js.map +1 -1
- package/dist/reach.d.ts +1 -0
- package/dist/reach.js +3 -2
- package/dist/reach.js.map +1 -1
- package/dist/relation.d.ts +1 -0
- package/dist/relation.js +3 -2
- package/dist/relation.js.map +1 -1
- package/dist/std.js +2 -1
- package/dist/std.js.map +1 -1
- package/dist/subsume.d.ts +1 -0
- package/dist/subsume.js +3 -2
- package/dist/subsume.js.map +1 -1
- package/dist/trim.d.ts +1 -0
- package/dist/trim.js +3 -2
- package/dist/trim.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/type.d.ts +1 -0
- package/dist/type.js.map +1 -1
- package/dist/utility.d.ts +8 -2
- package/dist/utility.js +9 -1
- package/dist/utility.js.map +1 -1
- package/dist/vet.d.ts +1 -0
- package/dist/vet.js +1 -1
- package/dist/vet.js.map +1 -1
- package/dist/view.d.ts +2 -1
- package/dist/view.js +379 -8
- package/dist/view.js.map +1 -1
- package/grammar/aontu.abnf +155 -0
- package/package.json +2 -1
- package/skill/grammar-card.md +5 -2
- package/src/agentsmd.ts +15 -3
- package/src/aontu.ts +7 -1
- package/src/cli.ts +267 -53
- package/src/diff.ts +7 -2
- package/src/format.ts +1146 -0
- package/src/hints.ts +5 -0
- package/src/jsonschema.ts +7 -1
- package/src/lang.ts +69 -5
- package/src/lsp.ts +5 -3
- package/src/mcp.ts +6 -4
- package/src/patch.ts +7 -0
- package/src/query.ts +8 -4
- package/src/reach.ts +7 -2
- package/src/relation.ts +7 -2
- package/src/std.ts +2 -1
- package/src/subsume.ts +7 -2
- package/src/trim.ts +7 -2
- package/src/type.ts +8 -0
- package/src/utility.ts +27 -2
- package/src/vet.ts +9 -3
- package/src/view.ts +442 -9
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
; Aontu --- published grammar (ABNF, RFC 5234 + RFC 7405).
|
|
2
|
+
;
|
|
3
|
+
; The same language as grammar/aontu.gbnf, rule for rule and name for
|
|
4
|
+
; name, in the notation an RFC reader expects. The GBNF form is for a
|
|
5
|
+
; constrained decoder; THIS form is for a person, and for the railroad
|
|
6
|
+
; diagram in the language reference, which is generated from this file
|
|
7
|
+
; (ts/scripts/figures.cjs).
|
|
8
|
+
;
|
|
9
|
+
; It covers the DOCUMENTED EMISSION SURFACE: what a model should be
|
|
10
|
+
; allowed to write, which is a superset of JSON plus the operators,
|
|
11
|
+
; constraints and marks the language's own canonical form emits. It is
|
|
12
|
+
; CONSERVATIVE BY CONSTRUCTION --- it may accept less than the parser
|
|
13
|
+
; does, never more. The same two deliberate exclusions the GBNF has:
|
|
14
|
+
;
|
|
15
|
+
; - `@"..."` includes. A generated document should describe values,
|
|
16
|
+
; not reach for files.
|
|
17
|
+
; - Unquoted keys and the other spellings the parser tolerates.
|
|
18
|
+
; Canon quotes every key, and one spelling is what a grammar is
|
|
19
|
+
; for.
|
|
20
|
+
;
|
|
21
|
+
; TWO NOTATION CHOICES worth stating, because both are load-bearing.
|
|
22
|
+
;
|
|
23
|
+
; EVERY LITERAL IS CASE-SENSITIVE, spelled `%s"..."` (RFC 7405). A
|
|
24
|
+
; plain `"..."` is case-INSENSITIVE in RFC 5234, and Aontu is not:
|
|
25
|
+
; `TRUE` is a bare word and `true` is a boolean. The reader in
|
|
26
|
+
; ts/scripts/abnf.cjs refuses a bare quoted string rather than guess
|
|
27
|
+
; which was meant.
|
|
28
|
+
;
|
|
29
|
+
; ALTERNATION IS ORDERED. RFC 5234's `/` is formally unordered, and
|
|
30
|
+
; the consumers of this file (a PEG-style matcher here, a railroad
|
|
31
|
+
; renderer) take the first branch that matches. Where one spelling is
|
|
32
|
+
; a prefix of another the longer comes first --- `exact` before
|
|
33
|
+
; `number`, `refer` before `rem` before `re`, `biginteger` before
|
|
34
|
+
; `boolean` --- so the ordered reading and the unordered one accept
|
|
35
|
+
; the same language. ts/test/grammar.test.ts holds this file to the
|
|
36
|
+
; whole canon corpus of test/spec/*.tsv, which is what proves it.
|
|
37
|
+
|
|
38
|
+
root = ws value ws
|
|
39
|
+
|
|
40
|
+
; No pipe. `|>` was parse-time sugar; it was removed, `x |> f(a)`
|
|
41
|
+
; being written `f(x, a)`.
|
|
42
|
+
value = disjunct
|
|
43
|
+
|
|
44
|
+
disjunct = conjunct *( ws %s"|" ws conjunct )
|
|
45
|
+
|
|
46
|
+
conjunct = prefixed *( ws %s"&" ws prefixed )
|
|
47
|
+
|
|
48
|
+
; A preference marks the alternative a generation picks.
|
|
49
|
+
prefixed = %s"*" ws prefixed / sum
|
|
50
|
+
|
|
51
|
+
sum = atom *( ws %s"+" ws atom )
|
|
52
|
+
|
|
53
|
+
atom = map
|
|
54
|
+
/ list
|
|
55
|
+
/ func
|
|
56
|
+
/ ref
|
|
57
|
+
/ kind
|
|
58
|
+
/ place
|
|
59
|
+
/ scalar
|
|
60
|
+
/ %s"(" ws value ws %s")"
|
|
61
|
+
|
|
62
|
+
map = %s"{" ws [ entry *( ws %s"," ws entry ) ws ] %s"}"
|
|
63
|
+
|
|
64
|
+
entry = spread / pair
|
|
65
|
+
|
|
66
|
+
; The template every key of the bag must also satisfy.
|
|
67
|
+
spread = %s"&" ws %s":" ws value
|
|
68
|
+
|
|
69
|
+
pair = string ws [ %s"?" ] ws %s":" ws value
|
|
70
|
+
|
|
71
|
+
; A list ELEMENT is a value, not a pair --- only the template is keyed.
|
|
72
|
+
list = %s"[" ws [ element *( ws %s"," ws element ) ws ] %s"]"
|
|
73
|
+
|
|
74
|
+
element = spread / value
|
|
75
|
+
|
|
76
|
+
; The builtins, applied. The name set is closed on purpose: an unknown
|
|
77
|
+
; function is a parse-time error in the engine, so a grammar that
|
|
78
|
+
; allowed any name would over-approximate.
|
|
79
|
+
func = name %s"(" ws [ value *( ws %s"," ws value ) ws ] %s")"
|
|
80
|
+
|
|
81
|
+
; ORDER MATTERS where one name is a prefix of another: `refer` is
|
|
82
|
+
; listed before `re`, and `rem` before `re` as well.
|
|
83
|
+
name = %s"above" / %s"acyclic" / %s"add" / %s"below" / %s"close"
|
|
84
|
+
/ %s"copy" / %s"deprecate" / %s"div"
|
|
85
|
+
/ %s"each" / %s"filter" / %s"greatest"
|
|
86
|
+
/ %s"hide"
|
|
87
|
+
/ %s"inverse" / %s"join" / %s"key" / %s"least"
|
|
88
|
+
/ %s"length" / %s"list" / %s"lower" / %s"map" / %s"match"
|
|
89
|
+
/ %s"max" / %s"min" / %s"mod" / %s"move"
|
|
90
|
+
/ %s"mul" / %s"must"
|
|
91
|
+
/ %s"neq"
|
|
92
|
+
/ %s"open" / %s"pack" / %s"path" / %s"pick" / %s"pref"
|
|
93
|
+
/ %s"refer" / %s"rel" / %s"rem" / %s"re" / %s"super"
|
|
94
|
+
/ %s"sub" / %s"sum"
|
|
95
|
+
/ %s"type"
|
|
96
|
+
/ %s"unique" / %s"upper"
|
|
97
|
+
|
|
98
|
+
; A path reference, absolute from the document root. At least one
|
|
99
|
+
; segment: a bare `$` is an incomplete expression, not a reference.
|
|
100
|
+
; A RELATIVE reference has no `$`: `.n` names a sibling, resolved
|
|
101
|
+
; against the enclosing map rather than the document root. Canon emits
|
|
102
|
+
; one wherever a spread template survives unresolved, so a grammar
|
|
103
|
+
; without it cannot parse this engine's own output. No conflict with
|
|
104
|
+
; `number`: a numeric literal always starts with a digit or `-`.
|
|
105
|
+
ref = %s"$" 1*( %s"." segment ) / 1*( %s"." segment )
|
|
106
|
+
|
|
107
|
+
; No `-`: it is not a bare-text character (test/spec/op-chars.tsv pins
|
|
108
|
+
; `a:6-2` as a parse error), so admitting it would over-approximate.
|
|
109
|
+
segment = 1*( ALPHA / DIGIT / %s"_" )
|
|
110
|
+
|
|
111
|
+
; The placeholder: a hole a call is filled through. BARE only --- `"_"`
|
|
112
|
+
; is an ordinary string, and a longer bare word containing it is
|
|
113
|
+
; ordinary text.
|
|
114
|
+
place = %s"_"
|
|
115
|
+
|
|
116
|
+
; `biginteger` before `bigdecimal` is not required (they differ at the
|
|
117
|
+
; fourth character), but `biginteger` before `boolean` is: see the
|
|
118
|
+
; ordered-alternation note above.
|
|
119
|
+
kind = %s"biginteger" / %s"bigdecimal" / %s"boolean" / %s"float"
|
|
120
|
+
/ %s"integer" / %s"number" / %s"string" / %s"top" / %s"nil"
|
|
121
|
+
|
|
122
|
+
; `exact` before `number`, or `0d5` would match `number` as the single
|
|
123
|
+
; digit `0` and leave `d5` unconsumed.
|
|
124
|
+
scalar = string / exact / number / %s"true" / %s"false" / %s"null"
|
|
125
|
+
|
|
126
|
+
string = DQUOTE *char DQUOTE
|
|
127
|
+
|
|
128
|
+
char = unescaped / %x5C escape
|
|
129
|
+
|
|
130
|
+
; Every code point but the quote and the backslash, which is what the
|
|
131
|
+
; GBNF's `[^"\\]` says. Control characters included: canon writes them
|
|
132
|
+
; escaped, and a grammar that refused them would refuse less than the
|
|
133
|
+
; parser accepts in the one direction this file may not.
|
|
134
|
+
unescaped = %x00-21 / %x23-5B / %x5D-10FFFF
|
|
135
|
+
|
|
136
|
+
escape = DQUOTE / %x5C / %s"/" / %s"b" / %s"f" / %s"n" / %s"r"
|
|
137
|
+
/ %s"t" / %s"u" hex hex hex hex
|
|
138
|
+
|
|
139
|
+
hex = DIGIT / %x41-46 / %x61-66
|
|
140
|
+
|
|
141
|
+
; The exact leaves: arbitrary precision, spelled with the 0d marker.
|
|
142
|
+
exact = [ %s"-" ] %s"0d" digits [ %s"." digits ] [ exponent ]
|
|
143
|
+
|
|
144
|
+
number = [ %s"-" ] digits [ %s"." digits ] [ exponent ]
|
|
145
|
+
|
|
146
|
+
exponent = ( %s"e" / %s"E" ) [ %s"-" / %s"+" ] digits
|
|
147
|
+
|
|
148
|
+
digits = 1*DIGIT
|
|
149
|
+
|
|
150
|
+
ws = *( %x20 / %x09 / %x0A / %x0D )
|
|
151
|
+
|
|
152
|
+
; RFC 5234's core rules, written out so this file stands alone.
|
|
153
|
+
ALPHA = %x41-5A / %x61-7A
|
|
154
|
+
DIGIT = %x30-39
|
|
155
|
+
DQUOTE = %x22
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aontu",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.56.0",
|
|
4
4
|
"main": "dist/aontu.js",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"types": "dist/aontu.d.ts",
|
|
@@ -79,6 +79,7 @@
|
|
|
79
79
|
"@tabnas/yaml": "0.5.7"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
|
+
"@tabnas/railroad": "0.3.6",
|
|
82
83
|
"@types/node": "26.2.0",
|
|
83
84
|
"memfs": "4.68.1",
|
|
84
85
|
"typescript": "7.0.2"
|
package/skill/grammar-card.md
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
# Aontu grammar card
|
|
2
2
|
|
|
3
3
|
Everything the language spells, on one page. The published machine
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
grammars are [`grammar/aontu.abnf`](../grammar/aontu.abnf) — the
|
|
5
|
+
notation a person reads, with railroad diagrams — and
|
|
6
|
+
[`aontu.gbnf`](../grammar/aontu.gbnf), `aontu.lark` and
|
|
7
|
+
`aontu.tmLanguage.json` for constrained decoding, parsing and
|
|
8
|
+
highlighting; this is their human twin.
|
|
6
9
|
|
|
7
10
|
## Values
|
|
8
11
|
|
package/src/agentsmd.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/* Copyright (c) 2025 Richard Rodger, MIT License */
|
|
2
|
+
import { includeOpts } from './utility'
|
|
2
3
|
|
|
3
4
|
// THE AGENTS.md STANZA (G7 phase 6,
|
|
4
5
|
// docs/capability-review/g7-machine-access.md): generated FROM the
|
|
@@ -40,6 +41,11 @@ export type AgentsMdOptions = {
|
|
|
40
41
|
// The include capability this document evaluates under
|
|
41
42
|
// (G5, docs/trust.md); vet's precedent.
|
|
42
43
|
trust?: TrustOptions
|
|
44
|
+
|
|
45
|
+
// Extensions additionally read as text (the CLI's `--text-ext`).
|
|
46
|
+
// Rides beside `trust` because it is the other half of what an
|
|
47
|
+
// include may read.
|
|
48
|
+
textExt?: string[]
|
|
43
49
|
}
|
|
44
50
|
|
|
45
51
|
|
|
@@ -49,8 +55,7 @@ export function agentsMd(
|
|
|
49
55
|
const options = opts ?? {}
|
|
50
56
|
const name = options.name ?? 'the definition'
|
|
51
57
|
|
|
52
|
-
const aontu = new Aontu(
|
|
53
|
-
null == options.trust ? undefined : { trust: options.trust })
|
|
58
|
+
const aontu = new Aontu(includeOpts(options))
|
|
54
59
|
const ctx = aontu.ctx({ collect: true })
|
|
55
60
|
const parseOpts = null == options.path ? undefined : { path: options.path }
|
|
56
61
|
const v: any = aontu.unify(src, parseOpts, ctx)
|
|
@@ -59,7 +64,14 @@ export function agentsMd(
|
|
|
59
64
|
}
|
|
60
65
|
|
|
61
66
|
const keys = true === v.isMap ? Object.keys(v.peg).sort(cmpCodePoint) : []
|
|
62
|
-
|
|
67
|
+
// THE SHAPE IS A SECOND EVALUATION, and it runs under the same
|
|
68
|
+
// include options as the first. Taking `path` alone made it a
|
|
69
|
+
// narrower reader than the stanza around it: a document whose keys
|
|
70
|
+
// arrive through a `--text-ext` include listed those keys and then
|
|
71
|
+
// reported an EMPTY shape, because the read the shape came from
|
|
72
|
+
// refused the include the read above it had just honoured.
|
|
73
|
+
const shape = get(src, '$',
|
|
74
|
+
{ view: 'types', depth: 2, path: options.path, ...includeOpts(options) })
|
|
63
75
|
|
|
64
76
|
// A REAL path, so the example command works as written: the first
|
|
65
77
|
// root key when there is one, the root itself when there is not.
|
package/src/aontu.ts
CHANGED
|
@@ -25,6 +25,7 @@ import { agentsMd } from './agentsmd'
|
|
|
25
25
|
import { graphOf } from './graph'
|
|
26
26
|
import { relationCheck, relationErrors } from './relation'
|
|
27
27
|
import { view, viewSet, viewTree } from './view'
|
|
28
|
+
import { format, unifiedDiff } from './format'
|
|
28
29
|
|
|
29
30
|
|
|
30
31
|
// VERSION is the Aontu npm package version, and mirrors
|
|
@@ -34,7 +35,7 @@ import { view, viewSet, viewTree } from './view'
|
|
|
34
35
|
// Kept in step with package.json by the `version` npm lifecycle script,
|
|
35
36
|
// which runs on `npm version` / `npm run repo-bump`. version.test.ts
|
|
36
37
|
// fails if the two ever drift.
|
|
37
|
-
const VERSION = '0.
|
|
38
|
+
const VERSION = '0.56.0'
|
|
38
39
|
|
|
39
40
|
|
|
40
41
|
// A module file's VALUE, as far as it goes. COLLECTED, not raised: a
|
|
@@ -475,6 +476,11 @@ export {
|
|
|
475
476
|
view,
|
|
476
477
|
viewSet,
|
|
477
478
|
viewTree,
|
|
479
|
+
|
|
480
|
+
// The source formatter (docs/design/FMT.0.md): the agreed form of a
|
|
481
|
+
// document, and the unified diff `aontu fmt --diff` prints.
|
|
482
|
+
format,
|
|
483
|
+
unifiedDiff,
|
|
478
484
|
}
|
|
479
485
|
|
|
480
486
|
|