aontu 0.52.0 → 0.53.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 +88 -0
- package/bin/aontu-mcp.js +4 -0
- package/dist/agentsmd.d.ts +16 -0
- package/dist/agentsmd.js +107 -0
- package/dist/agentsmd.js.map +1 -0
- package/dist/aontu.d.ts +14 -3
- package/dist/aontu.js +145 -4
- package/dist/aontu.js.map +1 -1
- package/dist/cli.d.ts +44 -1
- package/dist/cli.js +2401 -44
- package/dist/cli.js.map +1 -1
- package/dist/ctx.d.ts +16 -0
- package/dist/ctx.js +44 -0
- package/dist/ctx.js.map +1 -1
- package/dist/diff.d.ts +22 -0
- package/dist/diff.js +141 -0
- package/dist/diff.js.map +1 -0
- package/dist/err.d.ts +3 -1
- package/dist/err.js +48 -8
- package/dist/err.js.map +1 -1
- package/dist/graph.d.ts +16 -0
- package/dist/graph.js +73 -0
- package/dist/graph.js.map +1 -0
- package/dist/hcanon.d.ts +3 -0
- package/dist/hcanon.js +146 -0
- package/dist/hcanon.js.map +1 -0
- package/dist/hints.js +223 -5
- package/dist/hints.js.map +1 -1
- package/dist/jsonschema.d.ts +20 -0
- package/dist/jsonschema.js +391 -0
- package/dist/jsonschema.js.map +1 -0
- package/dist/lang.js +698 -35
- package/dist/lang.js.map +1 -1
- package/dist/lsp.d.ts +9 -2
- package/dist/lsp.js +262 -46
- package/dist/lsp.js.map +1 -1
- package/dist/mcp-server.d.ts +20 -0
- package/dist/mcp-server.js +147 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/mcp.d.ts +42 -0
- package/dist/mcp.js +814 -0
- package/dist/mcp.js.map +1 -0
- package/dist/mod-tool.d.ts +58 -0
- package/dist/mod-tool.js +498 -0
- package/dist/mod-tool.js.map +1 -0
- package/dist/mod.d.ts +31 -0
- package/dist/mod.js +250 -0
- package/dist/mod.js.map +1 -0
- package/dist/patch.d.ts +44 -0
- package/dist/patch.js +506 -0
- package/dist/patch.js.map +1 -0
- package/dist/provenance.d.ts +40 -0
- package/dist/provenance.js +335 -0
- package/dist/provenance.js.map +1 -0
- package/dist/query.d.ts +27 -0
- package/dist/query.js +294 -0
- package/dist/query.js.map +1 -0
- package/dist/reach.d.ts +14 -0
- package/dist/reach.js +140 -0
- package/dist/reach.js.map +1 -0
- package/dist/relation.d.ts +19 -0
- package/dist/relation.js +305 -0
- package/dist/relation.js.map +1 -0
- package/dist/report-sarif.d.ts +14 -0
- package/dist/report-sarif.js +102 -0
- package/dist/report-sarif.js.map +1 -0
- package/dist/site.d.ts +4 -0
- package/dist/site.js +31 -0
- package/dist/site.js.map +1 -1
- package/dist/std.d.ts +1 -0
- package/dist/std.js +73 -0
- package/dist/std.js.map +1 -0
- package/dist/subsume.d.ts +39 -0
- package/dist/subsume.js +526 -0
- package/dist/subsume.js.map +1 -0
- package/dist/trim.d.ts +19 -0
- package/dist/trim.js +155 -0
- package/dist/trim.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/type.d.ts +17 -1
- package/dist/type.js.map +1 -1
- package/dist/unify.d.ts +3 -1
- package/dist/unify.js +287 -18
- package/dist/unify.js.map +1 -1
- package/dist/utility.d.ts +9 -1
- package/dist/utility.js +122 -1
- package/dist/utility.js.map +1 -1
- package/dist/val/AggFuncVal.d.ts +33 -0
- package/dist/val/AggFuncVal.js +202 -0
- package/dist/val/AggFuncVal.js.map +1 -0
- package/dist/val/ArithFuncVal.d.ts +31 -0
- package/dist/val/ArithFuncVal.js +62 -0
- package/dist/val/ArithFuncVal.js.map +1 -0
- package/dist/val/BagVal.d.ts +5 -0
- package/dist/val/BagVal.js +96 -5
- package/dist/val/BagVal.js.map +1 -1
- package/dist/val/CloseFuncVal.js +9 -1
- package/dist/val/CloseFuncVal.js.map +1 -1
- package/dist/val/ConjunctVal.d.ts +1 -1
- package/dist/val/ConjunctVal.js +19 -0
- package/dist/val/ConjunctVal.js.map +1 -1
- package/dist/val/ConstraintVal.d.ts +48 -1
- package/dist/val/ConstraintVal.js +1501 -110
- package/dist/val/ConstraintVal.js.map +1 -1
- package/dist/val/CopyFuncVal.d.ts +1 -2
- package/dist/val/CopyFuncVal.js +7 -0
- package/dist/val/CopyFuncVal.js.map +1 -1
- package/dist/val/Decimal.d.ts +1 -0
- package/dist/val/Decimal.js +13 -0
- package/dist/val/Decimal.js.map +1 -1
- package/dist/val/DeprecateFuncVal.d.ts +11 -0
- package/dist/val/DeprecateFuncVal.js +47 -0
- package/dist/val/DeprecateFuncVal.js.map +1 -0
- package/dist/val/DisjunctVal.js +130 -21
- package/dist/val/DisjunctVal.js.map +1 -1
- package/dist/val/EachFuncVal.d.ts +15 -0
- package/dist/val/EachFuncVal.js +75 -0
- package/dist/val/EachFuncVal.js.map +1 -0
- package/dist/val/ExpectVal.d.ts +1 -0
- package/dist/val/ExpectVal.js +41 -4
- package/dist/val/ExpectVal.js.map +1 -1
- package/dist/val/FeatureVal.js +1 -1
- package/dist/val/FeatureVal.js.map +1 -1
- package/dist/val/FilterFuncVal.d.ts +15 -0
- package/dist/val/FilterFuncVal.js +91 -0
- package/dist/val/FilterFuncVal.js.map +1 -0
- package/dist/val/FuncBaseVal.d.ts +6 -1
- package/dist/val/FuncBaseVal.js +178 -2
- package/dist/val/FuncBaseVal.js.map +1 -1
- package/dist/val/HideFuncVal.js.map +1 -1
- package/dist/val/IdFuncVal.d.ts +13 -0
- package/dist/val/IdFuncVal.js +54 -0
- package/dist/val/IdFuncVal.js.map +1 -0
- package/dist/val/JunctionVal.js +7 -1
- package/dist/val/JunctionVal.js.map +1 -1
- package/dist/val/KeyFuncVal.d.ts +1 -1
- package/dist/val/KeyFuncVal.js +38 -30
- package/dist/val/KeyFuncVal.js.map +1 -1
- package/dist/val/ListVal.js +117 -17
- package/dist/val/ListVal.js.map +1 -1
- package/dist/val/LowerFuncVal.js.map +1 -1
- package/dist/val/MapVal.js +102 -8
- package/dist/val/MapVal.js.map +1 -1
- package/dist/val/MatchFuncVal.d.ts +15 -0
- package/dist/val/MatchFuncVal.js +107 -0
- package/dist/val/MatchFuncVal.js.map +1 -0
- package/dist/val/MoveFuncVal.js.map +1 -1
- package/dist/val/NilVal.js +24 -0
- package/dist/val/NilVal.js.map +1 -1
- package/dist/val/OpBaseVal.d.ts +1 -1
- package/dist/val/OpBaseVal.js +24 -2
- package/dist/val/OpBaseVal.js.map +1 -1
- package/dist/val/OpenFuncVal.js +4 -1
- package/dist/val/OpenFuncVal.js.map +1 -1
- package/dist/val/PackFuncVal.d.ts +15 -0
- package/dist/val/PackFuncVal.js +108 -0
- package/dist/val/PackFuncVal.js.map +1 -0
- package/dist/val/PathFuncVal.js.map +1 -1
- package/dist/val/PlaceVal.d.ts +13 -0
- package/dist/val/PlaceVal.js +131 -0
- package/dist/val/PlaceVal.js.map +1 -0
- package/dist/val/PlusOpVal.js +11 -2
- package/dist/val/PlusOpVal.js.map +1 -1
- package/dist/val/PrefFuncVal.js.map +1 -1
- package/dist/val/PrefVal.d.ts +2 -2
- package/dist/val/PrefVal.js +78 -23
- package/dist/val/PrefVal.js.map +1 -1
- package/dist/val/RefVal.d.ts +1 -1
- package/dist/val/RefVal.js +158 -30
- package/dist/val/RefVal.js.map +1 -1
- package/dist/val/ReferFuncVal.d.ts +36 -0
- package/dist/val/ReferFuncVal.js +303 -0
- package/dist/val/ReferFuncVal.js.map +1 -0
- package/dist/val/ScalarKindVal.d.ts +1 -2
- package/dist/val/ScalarKindVal.js +0 -11
- package/dist/val/ScalarKindVal.js.map +1 -1
- package/dist/val/TopVal.js.map +1 -1
- package/dist/val/TypeFuncVal.js.map +1 -1
- package/dist/val/UpperFuncVal.js.map +1 -1
- package/dist/val/Val.d.ts +9 -2
- package/dist/val/Val.js +150 -4
- package/dist/val/Val.js.map +1 -1
- package/dist/val/VarVal.js.map +1 -1
- package/dist/val/arith.d.ts +6 -0
- package/dist/val/arith.js +170 -0
- package/dist/val/arith.js.map +1 -0
- package/dist/vet.d.ts +45 -0
- package/dist/vet.js +776 -0
- package/dist/vet.js.map +1 -0
- package/dist/walk.d.ts +2 -0
- package/dist/walk.js +91 -0
- package/dist/walk.js.map +1 -0
- package/grammar/aontu.gbnf +130 -0
- package/grammar/aontu.lark +113 -0
- package/package.json +30 -15
- package/skill/SKILL.md +37 -0
- package/skill/error-codes.md +62 -0
- package/skill/examples.md +99 -0
- package/skill/grammar-card.md +57 -0
- package/src/agentsmd.ts +135 -0
- package/src/aontu.ts +192 -4
- package/src/cli.ts +2858 -71
- package/src/ctx.ts +81 -0
- package/src/diff.ts +196 -0
- package/src/err.ts +52 -8
- package/src/graph.ts +135 -0
- package/src/hcanon.ts +169 -0
- package/src/hints.ts +271 -5
- package/src/jsonschema.ts +511 -0
- package/src/lang.ts +779 -37
- package/src/lsp.ts +281 -47
- package/src/mcp-server.ts +187 -0
- package/src/mcp.ts +993 -0
- package/src/mod-tool.ts +679 -0
- package/src/mod.ts +344 -0
- package/src/patch.ts +624 -0
- package/src/provenance.ts +430 -0
- package/src/query.ts +379 -0
- package/src/reach.ts +184 -0
- package/src/relation.ts +395 -0
- package/src/report-sarif.ts +137 -0
- package/src/site.ts +36 -1
- package/src/std.ts +73 -0
- package/src/subsume.ts +690 -0
- package/src/trim.ts +195 -0
- package/src/tsconfig.json +10 -4
- package/src/type.ts +51 -2
- package/src/unify.ts +311 -16
- package/src/utility.ts +139 -1
- package/src/val/AggFuncVal.ts +319 -0
- package/src/val/ArithFuncVal.ts +108 -0
- package/src/val/BagVal.ts +101 -4
- package/src/val/CloseFuncVal.ts +9 -1
- package/src/val/ConjunctVal.ts +20 -0
- package/src/val/ConstraintVal.ts +1699 -116
- package/src/val/CopyFuncVal.ts +7 -1
- package/src/val/Decimal.ts +15 -0
- package/src/val/DeprecateFuncVal.ts +84 -0
- package/src/val/DisjunctVal.ts +139 -28
- package/src/val/EachFuncVal.ts +133 -0
- package/src/val/ExpectVal.ts +43 -6
- package/src/val/FeatureVal.ts +1 -1
- package/src/val/FilterFuncVal.ts +154 -0
- package/src/val/FuncBaseVal.ts +200 -3
- package/src/val/HideFuncVal.ts +0 -2
- package/src/val/IdFuncVal.ts +91 -0
- package/src/val/JunctionVal.ts +7 -1
- package/src/val/KeyFuncVal.ts +39 -35
- package/src/val/ListVal.ts +125 -18
- package/src/val/LowerFuncVal.ts +0 -1
- package/src/val/MapVal.ts +110 -8
- package/src/val/MatchFuncVal.ts +176 -0
- package/src/val/MoveFuncVal.ts +0 -2
- package/src/val/NilVal.ts +25 -0
- package/src/val/OpBaseVal.ts +26 -3
- package/src/val/OpenFuncVal.ts +4 -2
- package/src/val/PackFuncVal.ts +175 -0
- package/src/val/PathFuncVal.ts +0 -1
- package/src/val/PlaceVal.ts +193 -0
- package/src/val/PlusOpVal.ts +11 -2
- package/src/val/PrefFuncVal.ts +0 -1
- package/src/val/PrefVal.ts +79 -36
- package/src/val/RefVal.ts +163 -30
- package/src/val/ReferFuncVal.ts +387 -0
- package/src/val/ScalarKindVal.ts +0 -13
- package/src/val/TopVal.ts +0 -1
- package/src/val/TypeFuncVal.ts +0 -2
- package/src/val/UpperFuncVal.ts +0 -1
- package/src/val/Val.ts +213 -3
- package/src/val/VarVal.ts +0 -1
- package/src/val/arith.ts +316 -0
- package/src/vet.ts +992 -0
- package/src/walk.ts +99 -0
package/dist/mod.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export type ModuleRef = {
|
|
2
|
+
path: string;
|
|
3
|
+
major: number;
|
|
4
|
+
hash?: string;
|
|
5
|
+
};
|
|
6
|
+
export type ModuleFs = {
|
|
7
|
+
existsSync: (p: string) => boolean;
|
|
8
|
+
readFileSync: (p: string, enc: string) => string;
|
|
9
|
+
};
|
|
10
|
+
export declare function parseModuleRef(spec: string): ModuleRef | undefined;
|
|
11
|
+
export declare function moduleDir(store: string, ref: ModuleRef): string;
|
|
12
|
+
export declare function projectRoots(from: string, fs: ModuleFs): string[];
|
|
13
|
+
export declare function lockJson(text: string): string;
|
|
14
|
+
export declare function modCacheDir(): string | undefined;
|
|
15
|
+
export declare function modCacheDirFor(platform: string, env: Record<string, string | undefined>): string | undefined;
|
|
16
|
+
export declare function lockHash(root: string, ref: ModuleRef, fs: ModuleFs): string | undefined;
|
|
17
|
+
export type ModuleEval = (src: string, path: string) => {
|
|
18
|
+
gen: any;
|
|
19
|
+
hash: string;
|
|
20
|
+
};
|
|
21
|
+
export declare const MODULE_MAX_DEPTH = 16;
|
|
22
|
+
export type ModuleOptions = {
|
|
23
|
+
cache?: string;
|
|
24
|
+
eval: ModuleEval;
|
|
25
|
+
depth?: number;
|
|
26
|
+
};
|
|
27
|
+
export type ModuleFound = {
|
|
28
|
+
full: string;
|
|
29
|
+
src: string;
|
|
30
|
+
};
|
|
31
|
+
export declare function resolveModule(ref: ModuleRef, fromDir: string, fs: ModuleFs, options: ModuleOptions): ModuleFound;
|
package/dist/mod.js
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* Copyright (c) 2025 Richard Rodger, MIT License */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.MODULE_MAX_DEPTH = void 0;
|
|
5
|
+
exports.parseModuleRef = parseModuleRef;
|
|
6
|
+
exports.moduleDir = moduleDir;
|
|
7
|
+
exports.projectRoots = projectRoots;
|
|
8
|
+
exports.lockJson = lockJson;
|
|
9
|
+
exports.modCacheDir = modCacheDir;
|
|
10
|
+
exports.modCacheDirFor = modCacheDirFor;
|
|
11
|
+
exports.lockHash = lockHash;
|
|
12
|
+
exports.resolveModule = resolveModule;
|
|
13
|
+
// MODULE IDENTITY AND LOCAL RESOLUTION (G6 phase 2,
|
|
14
|
+
// docs/capability-review/g6-distribution.md).
|
|
15
|
+
//
|
|
16
|
+
// An import is still just `@"…"`; the string's SHAPE routes it, so the
|
|
17
|
+
// grammar is untouched and every existing include keeps its exact
|
|
18
|
+
// behaviour:
|
|
19
|
+
//
|
|
20
|
+
// service: @"corp.example/schemas/service@1"
|
|
21
|
+
// frozen: @"corp.example/schemas/service@1#aon1-4vJemVYtWFR2mQeN…"
|
|
22
|
+
// local: @"./fragment.aon" <- unchanged, not a module
|
|
23
|
+
//
|
|
24
|
+
// EVALUATION NEVER TOUCHES THE NETWORK. Resolution reads local stores
|
|
25
|
+
// only: `aon_vendor/` beside the project's `mod.aon`, then a
|
|
26
|
+
// content-addressed user cache keyed by canon-hash. Fetching is a
|
|
27
|
+
// separate, explicit tool step, and a module that is in neither store
|
|
28
|
+
// is an evaluation error that says so.
|
|
29
|
+
//
|
|
30
|
+
// TWO PINS, TWO ROLES. The lockfile's `oci` digest certifies that these
|
|
31
|
+
// are the bytes the registry served; the `canon` hash certifies that
|
|
32
|
+
// this is the MEANING that was reviewed. Only the second can be checked
|
|
33
|
+
// locally without the registry, and it is the one this file checks: the
|
|
34
|
+
// module is unified standalone and its canon-hash compared with the
|
|
35
|
+
// pin. An inline `#aon1-…` fragment is the same check without a
|
|
36
|
+
// lockfile — the degenerate mode for single-file and agent-sandbox use.
|
|
37
|
+
const node_path_1 = require("node:path");
|
|
38
|
+
// A module path is DOMAIN-SHAPED — the first segment carries a dot,
|
|
39
|
+
// which is what tells it apart from `./local.aon`, `pkg-name` and every
|
|
40
|
+
// other spelling already in use — and carries the major version in the
|
|
41
|
+
// path, CUE/Go-style, so two majors are two modules.
|
|
42
|
+
//
|
|
43
|
+
// The pattern is deliberately narrow: anything it does not match falls
|
|
44
|
+
// through to the existing resolver chain unchanged, so no document that
|
|
45
|
+
// worked before this phase can be routed somewhere new by it.
|
|
46
|
+
const MODULE_RE = /^([a-z0-9][a-z0-9-]*(?:\.[a-z0-9][a-z0-9-]*)+(?:\/[A-Za-z0-9._-]+)*)@(\d+)(?:#(aon1-[A-Za-z0-9_-]+))?$/;
|
|
47
|
+
function parseModuleRef(spec) {
|
|
48
|
+
const m = MODULE_RE.exec(spec);
|
|
49
|
+
if (null == m) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
path: m[1],
|
|
54
|
+
major: +m[2],
|
|
55
|
+
...(null == m[3] ? {} : { hash: m[3] }),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
// The directory a module's files live in, under a store root.
|
|
59
|
+
function moduleDir(store, ref) {
|
|
60
|
+
return (0, node_path_1.join)(store, ...ref.path.split('/')) + '@' + ref.major;
|
|
61
|
+
}
|
|
62
|
+
// EVERY project root at or above `from`, innermost first — a project
|
|
63
|
+
// root being a directory holding a `mod.aon`. This used to answer with
|
|
64
|
+
// the NEAREST one alone, and the plural is the fix, because a
|
|
65
|
+
// VENDORED MODULE IS A PROJECT INSIDE A PROJECT. A module in
|
|
66
|
+
// `aon_vendor/` carries its own `mod.aon`, which stopped the upward
|
|
67
|
+
// walk there, so a nested import resolved against the vendored
|
|
68
|
+
// module's own directory: a tree with no `aon_vendor/` of its own, and
|
|
69
|
+
// therefore a `module not fetched` for a dependency sitting flat
|
|
70
|
+
// beside it in the CONSUMER's vendor tree — the only layout `mod
|
|
71
|
+
// vendor` produces (use-cases/BUGS.md §31).
|
|
72
|
+
//
|
|
73
|
+
// The consumer's stores are searched after the module's own, so a
|
|
74
|
+
// module that vendors its dependencies nested still wins for its own
|
|
75
|
+
// tree, and one that does not falls through to the consumer that
|
|
76
|
+
// vendored it. The last element is `from` itself when nothing above it
|
|
77
|
+
// declares a module, which is the single-file inline-pin mode.
|
|
78
|
+
function projectRoots(from, fs) {
|
|
79
|
+
const roots = [];
|
|
80
|
+
let dir = from;
|
|
81
|
+
for (;;) {
|
|
82
|
+
if (fs.existsSync((0, node_path_1.join)(dir, 'mod.aon'))) {
|
|
83
|
+
roots.push(dir);
|
|
84
|
+
}
|
|
85
|
+
const up = (0, node_path_1.dirname)(dir);
|
|
86
|
+
if (up === dir) {
|
|
87
|
+
return 0 < roots.length ? roots : [from];
|
|
88
|
+
}
|
|
89
|
+
dir = up;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
// The lockfile's pin for one import, or undefined.
|
|
93
|
+
//
|
|
94
|
+
// `mod-lock.aon` is machine-written CANONICAL Aontu, and canonical
|
|
95
|
+
// Aontu whose leaves are scalars IS JSON — which is why reading it here
|
|
96
|
+
// needs no evaluator, and why a hand-edited lockfile that is no longer
|
|
97
|
+
// canonical simply does not parse. It is generated; the file says so.
|
|
98
|
+
// The lockfile's JSON: its canonical line, with the generated-file
|
|
99
|
+
// header stripped. The file is AONTU, so it may carry `#` comments —
|
|
100
|
+
// and the header `aontu mod tidy` writes says not to edit it, which is
|
|
101
|
+
// worth more than the two lines it costs to skip. Everything below the
|
|
102
|
+
// comments is the canonical map, and canonical Aontu whose leaves are
|
|
103
|
+
// scalars is JSON.
|
|
104
|
+
function lockJson(text) {
|
|
105
|
+
return text
|
|
106
|
+
.split('\n')
|
|
107
|
+
.filter((line) => !line.trimStart().startsWith('#'))
|
|
108
|
+
.join('\n');
|
|
109
|
+
}
|
|
110
|
+
// The user cache: `$XDG_CACHE_HOME/aontu/mod` unless the host names
|
|
111
|
+
// another, else the platform's own cache location. A host with nowhere
|
|
112
|
+
// to put one has no cache, which is a miss rather than a failure. One
|
|
113
|
+
// rule, in one place: the resolver reads this cache during evaluation
|
|
114
|
+
// and `aontu mod` writes into it, and two spellings of "where the cache
|
|
115
|
+
// is" is one bug.
|
|
116
|
+
function modCacheDir() {
|
|
117
|
+
return modCacheDirFor(process.platform, process.env);
|
|
118
|
+
}
|
|
119
|
+
// That rule with the platform and the environment PASSED IN, so the
|
|
120
|
+
// Windows arm can be exercised off Windows — the only way a rule about
|
|
121
|
+
// a platform nobody here runs gets tested at all. The Go port splits
|
|
122
|
+
// the same way (modCacheDirFor, go/aontu.go).
|
|
123
|
+
//
|
|
124
|
+
// THE ORDER IS EXPLICIT BEFORE IMPLICIT, and LOCALAPPDATA is LAST.
|
|
125
|
+
// XDG_CACHE_HOME is the override and wins everywhere, Windows included:
|
|
126
|
+
// a caller who names a cache directory means it. HOME comes next and is
|
|
127
|
+
// also honoured on Windows, where it is not standard but IS set by Git
|
|
128
|
+
// Bash and by most development shells — a user who has one expects
|
|
129
|
+
// their tools to agree about where home is.
|
|
130
|
+
//
|
|
131
|
+
// LOCALAPPDATA is the PLATFORM DEFAULT beneath both, which is the whole
|
|
132
|
+
// addition: Windows sets neither XDG_CACHE_HOME nor HOME by default —
|
|
133
|
+
// it supplies USERPROFILE and LOCALAPPDATA, and LOCALAPPDATA is what a
|
|
134
|
+
// cache directory means there — so a rule that knew only the first two
|
|
135
|
+
// left every Windows user with NO cache. Putting it ABOVE HOME was the
|
|
136
|
+
// first attempt and was wrong: it made an explicitly set HOME
|
|
137
|
+
// unreachable on Windows, which broke the existing fallback test the
|
|
138
|
+
// moment CI ran it. A platform default that overrides what the
|
|
139
|
+
// environment was told is not a default.
|
|
140
|
+
function modCacheDirFor(platform, env) {
|
|
141
|
+
const xdg = env.XDG_CACHE_HOME;
|
|
142
|
+
if ('string' === typeof xdg && '' !== xdg) {
|
|
143
|
+
return (0, node_path_1.join)(xdg, 'aontu', 'mod');
|
|
144
|
+
}
|
|
145
|
+
const home = env.HOME;
|
|
146
|
+
if ('string' === typeof home && '' !== home) {
|
|
147
|
+
return (0, node_path_1.join)(home, '.cache', 'aontu', 'mod');
|
|
148
|
+
}
|
|
149
|
+
if ('win32' === platform) {
|
|
150
|
+
const local = env.LOCALAPPDATA;
|
|
151
|
+
if ('string' === typeof local && '' !== local) {
|
|
152
|
+
return (0, node_path_1.join)(local, 'aontu', 'mod');
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return undefined;
|
|
156
|
+
}
|
|
157
|
+
function lockHash(root, ref, fs) {
|
|
158
|
+
const file = (0, node_path_1.join)(root, 'mod-lock.aon');
|
|
159
|
+
if (!fs.existsSync(file)) {
|
|
160
|
+
return undefined;
|
|
161
|
+
}
|
|
162
|
+
let lock;
|
|
163
|
+
try {
|
|
164
|
+
lock = JSON.parse(lockJson(fs.readFileSync(file, 'utf8')));
|
|
165
|
+
}
|
|
166
|
+
catch {
|
|
167
|
+
return undefined;
|
|
168
|
+
}
|
|
169
|
+
const entry = lock?.lock?.[ref.path + '@' + ref.major];
|
|
170
|
+
return 'string' === typeof entry?.canon ? entry.canon : undefined;
|
|
171
|
+
}
|
|
172
|
+
// How deep module verification may nest before it is refused. A module
|
|
173
|
+
// is verified by EVALUATING it, and that evaluation resolves the
|
|
174
|
+
// module's own imports -- so a vendor tree that leads back to itself
|
|
175
|
+
// (a symlink is enough) would recurse until the host's stack gave out,
|
|
176
|
+
// and a verdict that depends on the host's stack size is exactly what
|
|
177
|
+
// the determinism clause forbids (docs/trust.md, and the same argument
|
|
178
|
+
// unify_cycle rests on). Sixteen is far above any real vendor nesting.
|
|
179
|
+
exports.MODULE_MAX_DEPTH = 16;
|
|
180
|
+
// A refusal that carries its code to the parse layer, exactly as a
|
|
181
|
+
// denied include does (makeModelResolver's `deny`): the resolver
|
|
182
|
+
// THROWS, so a bare-member module import cannot vanish in the merge and
|
|
183
|
+
// leave a plausible, silently-partial document.
|
|
184
|
+
function refuse(code, message) {
|
|
185
|
+
const err = new Error(message);
|
|
186
|
+
err.code = code;
|
|
187
|
+
throw err;
|
|
188
|
+
}
|
|
189
|
+
// Resolve one module import against the local stores.
|
|
190
|
+
function resolveModule(ref, fromDir, fs, options) {
|
|
191
|
+
if (exports.MODULE_MAX_DEPTH <= (options.depth ?? 0)) {
|
|
192
|
+
refuse('module_depth', 'module depth: ' + ref.path + '@' + ref.major +
|
|
193
|
+
' (verification nested past ' + exports.MODULE_MAX_DEPTH + ')');
|
|
194
|
+
}
|
|
195
|
+
// EVERY enclosing project, innermost first (see projectRoots): a
|
|
196
|
+
// vendored module is a project inside a project, and its nested
|
|
197
|
+
// imports have to reach the tree the consumer vendored them into.
|
|
198
|
+
const roots = projectRoots(fromDir, fs);
|
|
199
|
+
// The PIN comes from the first lockfile that names this import. A
|
|
200
|
+
// vendored module usually ships none, so that is the consumer's --
|
|
201
|
+
// which is right: the consumer's lock is what its build is pinned to.
|
|
202
|
+
const expect = ref.hash ??
|
|
203
|
+
roots.map((r) => lockHash(r, ref, fs)).find((h) => null != h);
|
|
204
|
+
const stores = roots.map((r) => moduleDir((0, node_path_1.join)(r, 'aon_vendor'), ref));
|
|
205
|
+
if (null != options.cache && null != expect) {
|
|
206
|
+
// Content-addressed: the cache is keyed by the hash, so a cache hit
|
|
207
|
+
// is already the right MEANING before anything is read from it.
|
|
208
|
+
stores.push((0, node_path_1.join)(options.cache, expect));
|
|
209
|
+
}
|
|
210
|
+
const dir = stores.find((d) => fs.existsSync((0, node_path_1.join)(d, 'mod.aon')));
|
|
211
|
+
if (undefined === dir) {
|
|
212
|
+
// The wording is the contract (docs/capability-review/
|
|
213
|
+
// g6-distribution.md): it names the module AND the step that fixes
|
|
214
|
+
// it, because an agent reading this error is the audience.
|
|
215
|
+
refuse('module_missing', 'module not fetched: ' + ref.path + '@' + ref.major +
|
|
216
|
+
' (run: aontu mod get)');
|
|
217
|
+
}
|
|
218
|
+
// The module's own `mod.aon` names its entry file. Read with the
|
|
219
|
+
// evaluator rather than a regexp: a module file is ordinary Aontu,
|
|
220
|
+
// and the language reading its own metadata is the point.
|
|
221
|
+
const main = moduleMain((0, node_path_1.join)(dir, 'mod.aon'), fs, options);
|
|
222
|
+
const full = (0, node_path_1.join)(dir, main);
|
|
223
|
+
if (!fs.existsSync(full)) {
|
|
224
|
+
refuse('module_missing', 'module not fetched: ' + ref.path + '@' + ref.major +
|
|
225
|
+
' (run: aontu mod get)');
|
|
226
|
+
}
|
|
227
|
+
const src = fs.readFileSync(full, 'utf8');
|
|
228
|
+
if (null != expect) {
|
|
229
|
+
// VERIFICATION IS ALWAYS LOCAL. The registry's annotation is
|
|
230
|
+
// advisory; what decides is the hash of the module as it is on this
|
|
231
|
+
// machine, recomputed now.
|
|
232
|
+
const got = options.eval(src, full).hash;
|
|
233
|
+
if (got !== expect) {
|
|
234
|
+
refuse('module_integrity', 'module integrity: ' + ref.path + '@' + ref.major +
|
|
235
|
+
' expected ' + expect + ' got ' + got);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return { full, src };
|
|
239
|
+
}
|
|
240
|
+
// The `mod.main` a module file declares, or the default entry name.
|
|
241
|
+
// The module file is ORDINARY AONTU, read by the language itself — the
|
|
242
|
+
// toolchain dogfooding its own evaluator rather than pattern-matching
|
|
243
|
+
// its own syntax with a regexp.
|
|
244
|
+
function moduleMain(file, fs, options) {
|
|
245
|
+
const gen = options.eval(fs.readFileSync(file, 'utf8'), file).gen;
|
|
246
|
+
const main = gen?.mod?.main;
|
|
247
|
+
return 'string' === typeof main && '' !== main ? main : DEFAULT_MAIN;
|
|
248
|
+
}
|
|
249
|
+
const DEFAULT_MAIN = 'main.aon';
|
|
250
|
+
//# sourceMappingURL=mod.js.map
|
package/dist/mod.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":";AAAA,oDAAoD;;;;;;;;;;;AAEpD,oDAAoD;AACpD,8CAA8C;AAC9C,EAAE;AACF,uEAAuE;AACvE,kEAAkE;AAClE,aAAa;AACb,EAAE;AACF,+CAA+C;AAC/C,sEAAsE;AACtE,iEAAiE;AACjE,EAAE;AACF,sEAAsE;AACtE,6DAA6D;AAC7D,kEAAkE;AAClE,sEAAsE;AACtE,uCAAuC;AACvC,EAAE;AACF,wEAAwE;AACxE,qEAAqE;AACrE,wEAAwE;AACxE,wEAAwE;AACxE,oEAAoE;AACpE,gEAAgE;AAChE,wEAAwE;AAExE,yCAAoE;AAuBpE,oEAAoE;AACpE,wEAAwE;AACxE,uEAAuE;AACvE,qDAAqD;AACrD,EAAE;AACF,uEAAuE;AACvE,wEAAwE;AACxE,8DAA8D;AAC9D,MAAM,SAAS,GACb,wGAAwG,CAAA;AAG1G,wBAA+B,IAAY;IACzC,MAAM,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC9B,IAAI,IAAI,IAAI,CAAC,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AG,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,IAAI,CAAA;QACxC,IAAI,GAAG,KAAK,MAAM,EAAE,CAAC;YACnB,MAAM,CAAC,kBAAkB,EACvB,oBAAoB,GAAG,GAAG,CAAC,IAAI,GAAG,GAAG,GAAG,GAAG,CAAC,KAAK;gBACjD,YAAY,GAAG,MAAM,GAAG,OAAO,GAAG,GAAG,CAAC,CAAA;QAC1C,CAAC;IACH,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,CAAA;AACtB,CAAC;AAGD,oEAAoE;AACpE,uEAAuE;AACvE,sEAAsE;AACtE,gCAAgC;AAChC,SAAS,UAAU,CAAC,IAAY,EAAE,EAAY,EAAE,OAAsB;IACpE,MAAM,GAAG,GAAQ,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,CAAA;IACtE,MAAM,IAAI,GAAG,GAAG,EAAE,GAAG,EAAE,IAAI,CAAA;IAC3B,OAAO,QAAQ,KAAK,OAAO,IAAI,IAAI,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAA;AACtE,CAAC;AAGD,MAAM,YAAY,GAAG,UAAU,CAAA"}
|
package/dist/patch.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { TrustOptions } from './type';
|
|
2
|
+
import type { VetFinding, VetVerdict } from './vet';
|
|
3
|
+
export type PatchOptions = {
|
|
4
|
+
entryPath?: string;
|
|
5
|
+
overlayPath?: string;
|
|
6
|
+
inPlace?: boolean;
|
|
7
|
+
trust?: TrustOptions;
|
|
8
|
+
};
|
|
9
|
+
export type PatchReplacement = {
|
|
10
|
+
col: number;
|
|
11
|
+
file: string;
|
|
12
|
+
from: string;
|
|
13
|
+
path: string;
|
|
14
|
+
row: number;
|
|
15
|
+
to: string;
|
|
16
|
+
};
|
|
17
|
+
export type PatchReport = {
|
|
18
|
+
overlay: string;
|
|
19
|
+
appended: string[];
|
|
20
|
+
replaced: PatchReplacement[];
|
|
21
|
+
verdict: VetVerdict;
|
|
22
|
+
findings: VetFinding[];
|
|
23
|
+
};
|
|
24
|
+
export declare function parseAssignment(text: string): {
|
|
25
|
+
path: string;
|
|
26
|
+
value: string;
|
|
27
|
+
} | undefined;
|
|
28
|
+
export declare function overlayLine(path: string, value: string): string;
|
|
29
|
+
export declare function offsetAt(src: string, row: number, col: number): number;
|
|
30
|
+
export declare function spanAt(src: string, site: {
|
|
31
|
+
row: number;
|
|
32
|
+
col: number;
|
|
33
|
+
len: number;
|
|
34
|
+
}): string | undefined;
|
|
35
|
+
export declare function spanHolds(src: string, site: {
|
|
36
|
+
row: number;
|
|
37
|
+
col: number;
|
|
38
|
+
len: number;
|
|
39
|
+
}, expect: string): boolean;
|
|
40
|
+
export declare function spanValue(src: string): {
|
|
41
|
+
canon: string;
|
|
42
|
+
concrete: boolean;
|
|
43
|
+
} | undefined;
|
|
44
|
+
export declare function patch(entrySrc: string, overlaySrc: string, assignments: string[], opts?: PatchOptions): PatchReport;
|