@hailstails/hone 0.1.0-pre.3 → 0.1.0-pre.5
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/ADOPTING.md +44 -19
- package/MIGRATING.md +5 -5
- package/README.md +89 -24
- package/api/audit.d.ts +11 -0
- package/api/audit.mjs +1 -0
- package/api/rule-set.d.ts +4 -0
- package/api/rule-set.mjs +1 -0
- package/chunks/chunk-3HFJHJDO.js +53 -0
- package/chunks/chunk-7OVV6NEU.js +22 -0
- package/chunks/chunk-7PVPPH4C.js +13 -0
- package/chunks/chunk-HVABJ7T4.js +361 -0
- package/chunks/{chunk-TRCB27ET.js → chunk-IIMK5BCL.js} +55 -14
- package/chunks/{chunk-7ZJZZBSS.js → chunk-SWPCKTJV.js} +87 -380
- package/chunks/{chunk-HBY4ZWSP.js → chunk-VUG3DJHN.js} +7 -13
- package/chunks/{chunk-233U4FBA.js → chunk-YBWVUDIG.js} +1 -1
- package/core/check/tool-command.js +422 -115
- package/core/mechanism-port/piece-failure-types.d.ts +14 -0
- package/core/mechanism-port/runner-module-types.d.ts +13 -0
- package/core/mechanism-port/runner-result-types.d.ts +9 -0
- package/core/rule-set-reader/authored-rule-set-types.d.ts +48 -0
- package/core/values/anchor.d.ts +10 -0
- package/core/values/branded.d.ts +5 -0
- package/core/values/clause-address-types.d.ts +9 -0
- package/core/values/identifier-types.d.ts +5 -0
- package/core/values/json-value.d.ts +6 -0
- package/core/values/repo-path-types.d.ts +2 -0
- package/core/values/result.d.ts +7 -0
- package/docs/adding-a-discipline-or-mechanism.md +8 -5
- package/docs/extending.md +357 -0
- package/mechanisms/audit/CD-1/any-cast.js +9 -37
- package/mechanisms/audit/CD-19/import-boundaries.js +82 -63
- package/mechanisms/audit/CD-19/piece.json +5 -0
- package/mechanisms/audit/CD-2/cast-expressions.js +14 -37
- package/mechanisms/audit/CD-5/comments-directives.js +137 -55
- package/mechanisms/audit/CD-5/piece.json +7 -0
- package/mechanisms/audit/runner/README.md +1 -0
- package/mechanisms/audit/runner/runner.js +39 -33
- package/mechanisms/audit/runner/typescript-parse.d.ts +26 -0
- package/mechanisms/audit/runner/walker-piece.d.ts +60 -0
- package/mechanisms/eslint/runner/README.md +1 -1
- package/mechanisms/eslint/runner/eslint-piece-settings-types.d.ts +8 -0
- package/mechanisms/eslint/runner/runner.js +137 -71
- package/package.json +20 -3
- package/rules/CD-1/README.md +5 -5
- package/rules/CD-1/discipline.json +16 -6
- package/rules/CD-19/README.md +13 -3
- package/rules/CD-19/discipline.json +6 -8
- package/rules/CD-2/README.md +8 -4
- package/rules/CD-2/discipline.json +25 -7
- package/rules/CD-5/README.md +17 -5
- package/rules/CD-5/discipline.json +66 -0
|
@@ -2,83 +2,6 @@ import {
|
|
|
2
2
|
__export
|
|
3
3
|
} from "./chunk-NZLE2WMY.js";
|
|
4
4
|
|
|
5
|
-
// core/platform-ports/file-system-port.ts
|
|
6
|
-
import { accessSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
|
|
7
|
-
var NO_SUCH_FILE_CODE = "ENOENT";
|
|
8
|
-
var presenceAfterAccessFailure = (request) => request.thrown instanceof Error && "code" in request.thrown && request.thrown.code === NO_SUCH_FILE_CODE ? "absent" : "present";
|
|
9
|
-
var failureDetail = (request) => request.thrown instanceof Error ? request.thrown.message : String(request.thrown);
|
|
10
|
-
var createFileTextPort = (options) => ({
|
|
11
|
-
read: (request) => {
|
|
12
|
-
try {
|
|
13
|
-
return { outcome: "ok", value: options.fileSystem.readText({ path: request.path }) };
|
|
14
|
-
} catch (thrown) {
|
|
15
|
-
return {
|
|
16
|
-
outcome: "failed",
|
|
17
|
-
error: {
|
|
18
|
-
kind: "unreadable",
|
|
19
|
-
path: request.path,
|
|
20
|
-
detail: failureDetail({ thrown })
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
exists: (request) => {
|
|
26
|
-
try {
|
|
27
|
-
options.fileSystem.access({ path: request.path });
|
|
28
|
-
return "present";
|
|
29
|
-
} catch (thrown) {
|
|
30
|
-
return presenceAfterAccessFailure({ thrown });
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
write: (request) => {
|
|
34
|
-
try {
|
|
35
|
-
options.fileSystem.writeText({ path: request.path, text: request.text });
|
|
36
|
-
return { outcome: "ok", value: void 0 };
|
|
37
|
-
} catch (thrown) {
|
|
38
|
-
return {
|
|
39
|
-
outcome: "failed",
|
|
40
|
-
error: {
|
|
41
|
-
kind: "unwritable",
|
|
42
|
-
path: request.path,
|
|
43
|
-
detail: failureDetail({ thrown })
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
var defaultFileSystemSurface = {
|
|
50
|
-
readText: (request) => readFileSync(request.path, "utf8"),
|
|
51
|
-
writeText: (request) => {
|
|
52
|
-
writeFileSync(request.path, request.text);
|
|
53
|
-
},
|
|
54
|
-
access: (request) => {
|
|
55
|
-
accessSync(request.path);
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
var createDefaultFileTextPort = (_options) => createFileTextPort({ fileSystem: defaultFileSystemSurface });
|
|
59
|
-
|
|
60
|
-
// core/platform-ports/module-loader-port.ts
|
|
61
|
-
import { pathToFileURL } from "node:url";
|
|
62
|
-
var createModuleLoaderPort = (options) => ({
|
|
63
|
-
load: (request) => Promise.resolve().then(() => options.importModule({ path: request.path })).then(
|
|
64
|
-
(namespace) => ({ outcome: "ok", value: namespace }),
|
|
65
|
-
(thrown) => ({
|
|
66
|
-
outcome: "failed",
|
|
67
|
-
error: {
|
|
68
|
-
kind: "module-unloadable",
|
|
69
|
-
path: request.path,
|
|
70
|
-
detail: thrown instanceof Error ? thrown.message : String(thrown)
|
|
71
|
-
}
|
|
72
|
-
})
|
|
73
|
-
)
|
|
74
|
-
});
|
|
75
|
-
var defaultImportModule = (request) => import(pathToFileURL(request.path).href);
|
|
76
|
-
var createDefaultModuleLoaderPort = (_options) => createModuleLoaderPort({ importModule: defaultImportModule });
|
|
77
|
-
|
|
78
|
-
// core/platform-ports/path-port.ts
|
|
79
|
-
import platformPath, { posix, win32 } from "node:path";
|
|
80
|
-
import { fileURLToPath } from "node:url";
|
|
81
|
-
|
|
82
5
|
// node_modules/zod/v4/classic/external.js
|
|
83
6
|
var external_exports = {};
|
|
84
7
|
__export(external_exports, {
|
|
@@ -585,7 +508,7 @@ __export(core_exports2, {
|
|
|
585
508
|
parse: () => parse,
|
|
586
509
|
parseAsync: () => parseAsync,
|
|
587
510
|
prettifyError: () => prettifyError,
|
|
588
|
-
process: () =>
|
|
511
|
+
process: () => process,
|
|
589
512
|
regexes: () => regexes_exports,
|
|
590
513
|
registry: () => registry,
|
|
591
514
|
safeDecode: () => safeDecode,
|
|
@@ -11510,7 +11433,7 @@ function initializeContext(params) {
|
|
|
11510
11433
|
external: params?.external ?? void 0
|
|
11511
11434
|
};
|
|
11512
11435
|
}
|
|
11513
|
-
function
|
|
11436
|
+
function process(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
11514
11437
|
var _a3;
|
|
11515
11438
|
const def = schema._zod.def;
|
|
11516
11439
|
const seen = ctx.seen.get(schema);
|
|
@@ -11547,7 +11470,7 @@ function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
|
11547
11470
|
if (parent) {
|
|
11548
11471
|
if (!result.ref)
|
|
11549
11472
|
result.ref = parent;
|
|
11550
|
-
|
|
11473
|
+
process(parent, ctx, params);
|
|
11551
11474
|
ctx.seen.get(parent).isParent = true;
|
|
11552
11475
|
}
|
|
11553
11476
|
}
|
|
@@ -11835,14 +11758,14 @@ function isTransforming(_schema, _ctx) {
|
|
|
11835
11758
|
}
|
|
11836
11759
|
var createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
11837
11760
|
const ctx = initializeContext({ ...params, processors });
|
|
11838
|
-
|
|
11761
|
+
process(schema, ctx);
|
|
11839
11762
|
extractDefs(ctx, schema);
|
|
11840
11763
|
return finalize(ctx, schema);
|
|
11841
11764
|
};
|
|
11842
11765
|
var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
|
|
11843
11766
|
const { libraryOptions, target } = params ?? {};
|
|
11844
11767
|
const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors });
|
|
11845
|
-
|
|
11768
|
+
process(schema, ctx);
|
|
11846
11769
|
extractDefs(ctx, schema);
|
|
11847
11770
|
return finalize(ctx, schema);
|
|
11848
11771
|
};
|
|
@@ -12088,7 +12011,7 @@ var arrayProcessor = (schema, ctx, _json, params) => {
|
|
|
12088
12011
|
if (typeof maximum === "number")
|
|
12089
12012
|
json2.maxItems = maximum;
|
|
12090
12013
|
json2.type = "array";
|
|
12091
|
-
json2.items =
|
|
12014
|
+
json2.items = process(def.element, ctx, {
|
|
12092
12015
|
...params,
|
|
12093
12016
|
path: [...params.path, "items"]
|
|
12094
12017
|
});
|
|
@@ -12100,7 +12023,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
|
|
|
12100
12023
|
json2.properties = {};
|
|
12101
12024
|
const shape = def.shape;
|
|
12102
12025
|
for (const key in shape) {
|
|
12103
|
-
json2.properties[key] =
|
|
12026
|
+
json2.properties[key] = process(shape[key], ctx, {
|
|
12104
12027
|
...params,
|
|
12105
12028
|
path: [...params.path, "properties", key]
|
|
12106
12029
|
});
|
|
@@ -12123,7 +12046,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
|
|
|
12123
12046
|
if (ctx.io === "output")
|
|
12124
12047
|
json2.additionalProperties = false;
|
|
12125
12048
|
} else if (def.catchall) {
|
|
12126
|
-
json2.additionalProperties =
|
|
12049
|
+
json2.additionalProperties = process(def.catchall, ctx, {
|
|
12127
12050
|
...params,
|
|
12128
12051
|
path: [...params.path, "additionalProperties"]
|
|
12129
12052
|
});
|
|
@@ -12132,7 +12055,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
|
|
|
12132
12055
|
var unionProcessor = (schema, ctx, json2, params) => {
|
|
12133
12056
|
const def = schema._zod.def;
|
|
12134
12057
|
const isExclusive = def.inclusive === false;
|
|
12135
|
-
const options = def.options.map((x, i) =>
|
|
12058
|
+
const options = def.options.map((x, i) => process(x, ctx, {
|
|
12136
12059
|
...params,
|
|
12137
12060
|
path: [...params.path, isExclusive ? "oneOf" : "anyOf", i]
|
|
12138
12061
|
}));
|
|
@@ -12144,11 +12067,11 @@ var unionProcessor = (schema, ctx, json2, params) => {
|
|
|
12144
12067
|
};
|
|
12145
12068
|
var intersectionProcessor = (schema, ctx, json2, params) => {
|
|
12146
12069
|
const def = schema._zod.def;
|
|
12147
|
-
const a =
|
|
12070
|
+
const a = process(def.left, ctx, {
|
|
12148
12071
|
...params,
|
|
12149
12072
|
path: [...params.path, "allOf", 0]
|
|
12150
12073
|
});
|
|
12151
|
-
const b =
|
|
12074
|
+
const b = process(def.right, ctx, {
|
|
12152
12075
|
...params,
|
|
12153
12076
|
path: [...params.path, "allOf", 1]
|
|
12154
12077
|
});
|
|
@@ -12165,11 +12088,11 @@ var tupleProcessor = (schema, ctx, _json, params) => {
|
|
|
12165
12088
|
json2.type = "array";
|
|
12166
12089
|
const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
|
|
12167
12090
|
const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
|
|
12168
|
-
const prefixItems = def.items.map((x, i) =>
|
|
12091
|
+
const prefixItems = def.items.map((x, i) => process(x, ctx, {
|
|
12169
12092
|
...params,
|
|
12170
12093
|
path: [...params.path, prefixPath, i]
|
|
12171
12094
|
}));
|
|
12172
|
-
const rest = def.rest ?
|
|
12095
|
+
const rest = def.rest ? process(def.rest, ctx, {
|
|
12173
12096
|
...params,
|
|
12174
12097
|
path: [...params.path, restPath, ...ctx.target === "openapi-3.0" ? [def.items.length] : []]
|
|
12175
12098
|
}) : null;
|
|
@@ -12209,7 +12132,7 @@ var recordProcessor = (schema, ctx, _json, params) => {
|
|
|
12209
12132
|
const keyBag = keyType._zod.bag;
|
|
12210
12133
|
const patterns = keyBag?.patterns;
|
|
12211
12134
|
if (def.mode === "loose" && patterns && patterns.size > 0) {
|
|
12212
|
-
const valueSchema =
|
|
12135
|
+
const valueSchema = process(def.valueType, ctx, {
|
|
12213
12136
|
...params,
|
|
12214
12137
|
path: [...params.path, "patternProperties", "*"]
|
|
12215
12138
|
});
|
|
@@ -12219,12 +12142,12 @@ var recordProcessor = (schema, ctx, _json, params) => {
|
|
|
12219
12142
|
}
|
|
12220
12143
|
} else {
|
|
12221
12144
|
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
|
|
12222
|
-
json2.propertyNames =
|
|
12145
|
+
json2.propertyNames = process(def.keyType, ctx, {
|
|
12223
12146
|
...params,
|
|
12224
12147
|
path: [...params.path, "propertyNames"]
|
|
12225
12148
|
});
|
|
12226
12149
|
}
|
|
12227
|
-
json2.additionalProperties =
|
|
12150
|
+
json2.additionalProperties = process(def.valueType, ctx, {
|
|
12228
12151
|
...params,
|
|
12229
12152
|
path: [...params.path, "additionalProperties"]
|
|
12230
12153
|
});
|
|
@@ -12239,7 +12162,7 @@ var recordProcessor = (schema, ctx, _json, params) => {
|
|
|
12239
12162
|
};
|
|
12240
12163
|
var nullableProcessor = (schema, ctx, json2, params) => {
|
|
12241
12164
|
const def = schema._zod.def;
|
|
12242
|
-
const inner =
|
|
12165
|
+
const inner = process(def.innerType, ctx, params);
|
|
12243
12166
|
const seen = ctx.seen.get(schema);
|
|
12244
12167
|
if (ctx.target === "openapi-3.0") {
|
|
12245
12168
|
seen.ref = def.innerType;
|
|
@@ -12250,20 +12173,20 @@ var nullableProcessor = (schema, ctx, json2, params) => {
|
|
|
12250
12173
|
};
|
|
12251
12174
|
var nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
12252
12175
|
const def = schema._zod.def;
|
|
12253
|
-
|
|
12176
|
+
process(def.innerType, ctx, params);
|
|
12254
12177
|
const seen = ctx.seen.get(schema);
|
|
12255
12178
|
seen.ref = def.innerType;
|
|
12256
12179
|
};
|
|
12257
12180
|
var defaultProcessor = (schema, ctx, json2, params) => {
|
|
12258
12181
|
const def = schema._zod.def;
|
|
12259
|
-
|
|
12182
|
+
process(def.innerType, ctx, params);
|
|
12260
12183
|
const seen = ctx.seen.get(schema);
|
|
12261
12184
|
seen.ref = def.innerType;
|
|
12262
12185
|
json2.default = JSON.parse(JSON.stringify(def.defaultValue));
|
|
12263
12186
|
};
|
|
12264
12187
|
var prefaultProcessor = (schema, ctx, json2, params) => {
|
|
12265
12188
|
const def = schema._zod.def;
|
|
12266
|
-
|
|
12189
|
+
process(def.innerType, ctx, params);
|
|
12267
12190
|
const seen = ctx.seen.get(schema);
|
|
12268
12191
|
seen.ref = def.innerType;
|
|
12269
12192
|
if (ctx.io === "input")
|
|
@@ -12271,7 +12194,7 @@ var prefaultProcessor = (schema, ctx, json2, params) => {
|
|
|
12271
12194
|
};
|
|
12272
12195
|
var catchProcessor = (schema, ctx, json2, params) => {
|
|
12273
12196
|
const def = schema._zod.def;
|
|
12274
|
-
|
|
12197
|
+
process(def.innerType, ctx, params);
|
|
12275
12198
|
const seen = ctx.seen.get(schema);
|
|
12276
12199
|
seen.ref = def.innerType;
|
|
12277
12200
|
let catchValue;
|
|
@@ -12286,32 +12209,32 @@ var pipeProcessor = (schema, ctx, _json, params) => {
|
|
|
12286
12209
|
const def = schema._zod.def;
|
|
12287
12210
|
const inIsTransform = def.in._zod.traits.has("$ZodTransform");
|
|
12288
12211
|
const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out;
|
|
12289
|
-
|
|
12212
|
+
process(innerType, ctx, params);
|
|
12290
12213
|
const seen = ctx.seen.get(schema);
|
|
12291
12214
|
seen.ref = innerType;
|
|
12292
12215
|
};
|
|
12293
12216
|
var readonlyProcessor = (schema, ctx, json2, params) => {
|
|
12294
12217
|
const def = schema._zod.def;
|
|
12295
|
-
|
|
12218
|
+
process(def.innerType, ctx, params);
|
|
12296
12219
|
const seen = ctx.seen.get(schema);
|
|
12297
12220
|
seen.ref = def.innerType;
|
|
12298
12221
|
json2.readOnly = true;
|
|
12299
12222
|
};
|
|
12300
12223
|
var promiseProcessor = (schema, ctx, _json, params) => {
|
|
12301
12224
|
const def = schema._zod.def;
|
|
12302
|
-
|
|
12225
|
+
process(def.innerType, ctx, params);
|
|
12303
12226
|
const seen = ctx.seen.get(schema);
|
|
12304
12227
|
seen.ref = def.innerType;
|
|
12305
12228
|
};
|
|
12306
12229
|
var optionalProcessor = (schema, ctx, _json, params) => {
|
|
12307
12230
|
const def = schema._zod.def;
|
|
12308
|
-
|
|
12231
|
+
process(def.innerType, ctx, params);
|
|
12309
12232
|
const seen = ctx.seen.get(schema);
|
|
12310
12233
|
seen.ref = def.innerType;
|
|
12311
12234
|
};
|
|
12312
12235
|
var lazyProcessor = (schema, ctx, _json, params) => {
|
|
12313
12236
|
const innerType = schema._zod.innerType;
|
|
12314
|
-
|
|
12237
|
+
process(innerType, ctx, params);
|
|
12315
12238
|
const seen = ctx.seen.get(schema);
|
|
12316
12239
|
seen.ref = innerType;
|
|
12317
12240
|
};
|
|
@@ -12363,7 +12286,7 @@ function toJSONSchema(input, params) {
|
|
|
12363
12286
|
const defs = {};
|
|
12364
12287
|
for (const entry of registry2._idmap.entries()) {
|
|
12365
12288
|
const [_, schema] = entry;
|
|
12366
|
-
|
|
12289
|
+
process(schema, ctx2);
|
|
12367
12290
|
}
|
|
12368
12291
|
const schemas = {};
|
|
12369
12292
|
const external = {
|
|
@@ -12386,7 +12309,7 @@ function toJSONSchema(input, params) {
|
|
|
12386
12309
|
return { schemas };
|
|
12387
12310
|
}
|
|
12388
12311
|
const ctx = initializeContext({ ...params, processors: allProcessors });
|
|
12389
|
-
|
|
12312
|
+
process(input, ctx);
|
|
12390
12313
|
extractDefs(ctx, input);
|
|
12391
12314
|
return finalize(ctx, input);
|
|
12392
12315
|
}
|
|
@@ -12444,7 +12367,7 @@ var JSONSchemaGenerator = class {
|
|
|
12444
12367
|
* This must be called before emit().
|
|
12445
12368
|
*/
|
|
12446
12369
|
process(schema, _params = { path: [], schemaPath: [] }) {
|
|
12447
|
-
return
|
|
12370
|
+
return process(schema, this.ctx, _params);
|
|
12448
12371
|
}
|
|
12449
12372
|
/**
|
|
12450
12373
|
* Emit the final JSON Schema after processing.
|
|
@@ -14593,195 +14516,67 @@ function date4(params) {
|
|
|
14593
14516
|
// node_modules/zod/v4/classic/external.js
|
|
14594
14517
|
config(en_default());
|
|
14595
14518
|
|
|
14596
|
-
// core/values/
|
|
14597
|
-
var
|
|
14598
|
-
|
|
14599
|
-
|
|
14600
|
-
// core/platform-ports/path-port.ts
|
|
14601
|
-
var notAFileUrl = (request) => ({
|
|
14602
|
-
outcome: "failed",
|
|
14603
|
-
error: { kind: "not-a-file-url", url: request.url, detail: request.detail }
|
|
14604
|
-
});
|
|
14605
|
-
var absolutePathOfFileUrl = (request) => {
|
|
14606
|
-
try {
|
|
14607
|
-
const parsed = absolutePathSchema.safeParse(
|
|
14608
|
-
fileURLToPath(request.url, { windows: request.surface === win32 })
|
|
14609
|
-
);
|
|
14610
|
-
if (!parsed.success) {
|
|
14611
|
-
return notAFileUrl({ url: request.url, detail: "the file URL names no absolute path" });
|
|
14612
|
-
}
|
|
14613
|
-
return { outcome: "ok", value: parsed.data };
|
|
14614
|
-
} catch (thrown) {
|
|
14615
|
-
return notAFileUrl({
|
|
14616
|
-
url: request.url,
|
|
14617
|
-
detail: thrown instanceof Error ? thrown.message : String(thrown)
|
|
14618
|
-
});
|
|
14619
|
-
}
|
|
14620
|
-
};
|
|
14621
|
-
var absolutePathOf = (request) => {
|
|
14622
|
-
const parsed = absolutePathSchema.safeParse(request.resolved);
|
|
14623
|
-
if (!parsed.success) {
|
|
14624
|
-
return { outcome: "failed", error: { kind: "working-directory-unusable", path: request.path } };
|
|
14625
|
-
}
|
|
14626
|
-
return { outcome: "ok", value: parsed.data };
|
|
14627
|
-
};
|
|
14628
|
-
var fileUrlForm = (request) => URL.canParse(request.url) && new URL(request.url).protocol === "file:" ? "file-url" : "not-a-file-url";
|
|
14629
|
-
var UNREADABLE_WORKING_DIRECTORY = "";
|
|
14630
|
-
var REPOSITORY_SEPARATOR = "/";
|
|
14631
|
-
var WINDOWS_ANCHOR_ROOT = "C:\\";
|
|
14632
|
-
var anchorRootOf = (request) => request.surface === win32 ? WINDOWS_ANCHOR_ROOT : request.surface.sep;
|
|
14633
|
-
var workingDirectoryText = (request) => {
|
|
14634
|
-
try {
|
|
14635
|
-
return request.workingDirectory({});
|
|
14636
|
-
} catch {
|
|
14637
|
-
return UNREADABLE_WORKING_DIRECTORY;
|
|
14519
|
+
// core/values/branded-schema.ts
|
|
14520
|
+
var brandedTextSchema = (request) => request.text.transform((text, context) => {
|
|
14521
|
+
if (request.isBranded(text)) {
|
|
14522
|
+
return text;
|
|
14638
14523
|
}
|
|
14639
|
-
};
|
|
14640
|
-
|
|
14641
|
-
|
|
14642
|
-
var rootFormOf = (request) => {
|
|
14643
|
-
const root = request.surface.parse(request.path).root;
|
|
14644
|
-
if (root === "") {
|
|
14645
|
-
return "relative";
|
|
14646
|
-
}
|
|
14647
|
-
if (request.surface === win32 && DRIVE_LESS_ROOTS.includes(root)) {
|
|
14648
|
-
return "rooted-without-drive";
|
|
14649
|
-
}
|
|
14650
|
-
return request.surface.isAbsolute(request.path) ? "fully-rooted" : "drive-relative";
|
|
14651
|
-
};
|
|
14652
|
-
var workingDirectoryReadingOf = (request) => {
|
|
14653
|
-
const directory = workingDirectoryText(request);
|
|
14654
|
-
return rootFormOf({ path: directory, surface: request.surface }) === "fully-rooted" ? { usability: "usable", directory } : { usability: "unusable" };
|
|
14655
|
-
};
|
|
14656
|
-
var driveRelationOf = (request) => request.reading.usability === "usable" && rootOf({ path: request.reading.directory, surface: request.surface }).startsWith(request.driveRoot.toLowerCase()) ? "same-drive" : "another-drive";
|
|
14657
|
-
var driveRelativeFormOf = (request) => {
|
|
14658
|
-
const driveRoot = request.surface.parse(request.path).root;
|
|
14659
|
-
const reading = workingDirectoryReadingOf(request);
|
|
14660
|
-
if (reading.usability === "unusable" || driveRelationOf({ driveRoot, reading, surface: request.surface }) === "another-drive") {
|
|
14661
|
-
return request.surface.resolve(`${driveRoot}${request.surface.sep}`, request.path);
|
|
14662
|
-
}
|
|
14663
|
-
return request.surface.resolve(reading.directory, request.path);
|
|
14664
|
-
};
|
|
14665
|
-
var rootedWithoutDriveFormOf = (request) => {
|
|
14666
|
-
const reading = workingDirectoryReadingOf(request);
|
|
14667
|
-
if (reading.usability === "unusable") {
|
|
14668
|
-
return request.surface.normalize(request.path);
|
|
14669
|
-
}
|
|
14670
|
-
return request.surface.resolve(request.surface.parse(reading.directory).root, request.path);
|
|
14671
|
-
};
|
|
14672
|
-
var relativeFormOf = (request) => {
|
|
14673
|
-
const reading = workingDirectoryReadingOf(request);
|
|
14674
|
-
if (reading.usability === "unusable") {
|
|
14675
|
-
return request.surface.normalize(request.path);
|
|
14676
|
-
}
|
|
14677
|
-
return request.surface.resolve(reading.directory, request.path);
|
|
14678
|
-
};
|
|
14679
|
-
var absoluteFormOf = (request) => {
|
|
14680
|
-
const rootForm = rootFormOf(request);
|
|
14681
|
-
switch (rootForm) {
|
|
14682
|
-
case "fully-rooted":
|
|
14683
|
-
return request.surface.normalize(request.path);
|
|
14684
|
-
case "rooted-without-drive":
|
|
14685
|
-
return rootedWithoutDriveFormOf(request);
|
|
14686
|
-
case "drive-relative":
|
|
14687
|
-
return driveRelativeFormOf(request);
|
|
14688
|
-
case "relative":
|
|
14689
|
-
return relativeFormOf(request);
|
|
14690
|
-
}
|
|
14691
|
-
};
|
|
14692
|
-
var driveFormOf = (request) => request.surface === win32 && rootFormOf(request) === "fully-rooted" ? "drive-carrying" : "drive-less";
|
|
14693
|
-
var relativeLocationBetween = (request) => {
|
|
14694
|
-
const fromDriveForm = driveFormOf({ path: request.from, surface: request.surface });
|
|
14695
|
-
if (fromDriveForm !== driveFormOf({ path: request.to, surface: request.surface })) {
|
|
14696
|
-
return { relation: "different-root" };
|
|
14697
|
-
}
|
|
14698
|
-
if (fromDriveForm === "drive-carrying") {
|
|
14699
|
-
return relativeLocationOf(request);
|
|
14700
|
-
}
|
|
14701
|
-
const anchorRoot = anchorRootOf(request);
|
|
14702
|
-
return relativeLocationOf({
|
|
14703
|
-
surface: request.surface,
|
|
14704
|
-
from: request.surface.resolve(anchorRoot, request.from),
|
|
14705
|
-
to: request.surface.resolve(anchorRoot, request.to)
|
|
14706
|
-
});
|
|
14707
|
-
};
|
|
14708
|
-
var relativeLocationOf = (request) => rootOf({ path: request.from, surface: request.surface }) === rootOf({ path: request.to, surface: request.surface }) ? {
|
|
14709
|
-
relation: "within-root",
|
|
14710
|
-
path: repositoryFormOf({ surface: request.surface, path: request.surface.relative(request.from, request.to) })
|
|
14711
|
-
} : { relation: "different-root" };
|
|
14712
|
-
var repositoryFormOf = (request) => request.path.split(request.surface.sep).join(REPOSITORY_SEPARATOR);
|
|
14713
|
-
var surfaceOf = (request) => {
|
|
14714
|
-
switch (request.flavour) {
|
|
14715
|
-
case "posix":
|
|
14716
|
-
return posix;
|
|
14717
|
-
case "windows":
|
|
14718
|
-
return win32;
|
|
14719
|
-
case "platform":
|
|
14720
|
-
return platformPath;
|
|
14721
|
-
}
|
|
14722
|
-
};
|
|
14723
|
-
var portOver = (options) => ({
|
|
14724
|
-
join: (request) => options.surface.join(...request.segments),
|
|
14725
|
-
joinRepository: (request) => posix.join(...request.segments),
|
|
14726
|
-
relative: (request) => relativeLocationBetween({
|
|
14727
|
-
surface: options.surface,
|
|
14728
|
-
from: absoluteFormOf({ path: request.from, surface: options.surface, workingDirectory: options.workingDirectory }),
|
|
14729
|
-
to: absoluteFormOf({ path: request.to, surface: options.surface, workingDirectory: options.workingDirectory })
|
|
14730
|
-
}),
|
|
14731
|
-
directoryOf: (request) => options.surface.dirname(request.path),
|
|
14732
|
-
repositoryDirectoryOf: (request) => posix.dirname(request.path),
|
|
14733
|
-
resolve: (request) => absolutePathOf({
|
|
14734
|
-
path: request.path,
|
|
14735
|
-
resolved: absoluteFormOf({ path: request.path, surface: options.surface, workingDirectory: options.workingDirectory })
|
|
14736
|
-
}),
|
|
14737
|
-
fromFileUrl: (request) => fileUrlForm({ url: request.url }) === "not-a-file-url" ? notAFileUrl({ url: request.url, detail: "the text is not a file: URL" }) : absolutePathOfFileUrl({ url: request.url, surface: options.surface })
|
|
14738
|
-
});
|
|
14739
|
-
var createPathPort = (options) => portOver({ surface: surfaceOf({ flavour: options.flavour }), workingDirectory: options.workingDirectory });
|
|
14740
|
-
var defaultWorkingDirectory = () => process.cwd();
|
|
14741
|
-
var createDefaultPathPort = (_options) => createPathPort({ flavour: "platform", workingDirectory: defaultWorkingDirectory });
|
|
14742
|
-
|
|
14743
|
-
// core/values/install-layout.ts
|
|
14744
|
-
var FOLDERS_BETWEEN_INSTALL_ROOT_AND_ENTRY = {
|
|
14745
|
-
command: 2,
|
|
14746
|
-
runner: 3
|
|
14747
|
-
};
|
|
14748
|
-
var installRootAboveEntry = (request) => Array.from({ length: FOLDERS_BETWEEN_INSTALL_ROOT_AND_ENTRY[request.entry] + 1 }).reduce(
|
|
14749
|
-
(path) => request.directoryOf(path),
|
|
14750
|
-
request.entryFile
|
|
14751
|
-
);
|
|
14752
|
-
var BUILT_MODULE_EXTENSION = ".js";
|
|
14753
|
-
var SOURCE_MODULE_EXTENSION = ".ts";
|
|
14754
|
-
var moduleExtensionOf = (request) => new URL(request.moduleUrl).pathname.endsWith(BUILT_MODULE_EXTENSION) ? BUILT_MODULE_EXTENSION : SOURCE_MODULE_EXTENSION;
|
|
14755
|
-
var installFormOf = (request) => request.moduleExtension === BUILT_MODULE_EXTENSION ? "package" : "source";
|
|
14756
|
-
var runnerModuleSegmentsOf = (request) => [request.installRoot, "mechanisms", request.mechanism, "runner", `runner${request.moduleExtension}`];
|
|
14757
|
-
var MODULE_EXTENSIONS = [SOURCE_MODULE_EXTENSION, BUILT_MODULE_EXTENSION];
|
|
14758
|
-
var moduleFileForm = (request) => MODULE_EXTENSIONS.some((extension) => request.text.endsWith(extension)) ? "module-file" : "not-module-file";
|
|
14759
|
-
|
|
14760
|
-
// core/values/repo-path.ts
|
|
14761
|
-
var UNWALKABLE_SEGMENTS = ["", ".", ".."];
|
|
14762
|
-
var LEADING_DRIVE_LETTER = /^[A-Za-z]:/;
|
|
14763
|
-
var LINE_BREAK_OR_NUL = /[\n\r\0]/;
|
|
14764
|
-
var isRepoPathText = (request) => !request.text.startsWith("/") && !LEADING_DRIVE_LETTER.test(request.text) && !request.text.includes("\\") && !LINE_BREAK_OR_NUL.test(request.text) && request.text.split("/").every((segment) => !UNWALKABLE_SEGMENTS.includes(segment)) ? "repo-path" : "not-repo-path";
|
|
14765
|
-
var repoPathSchema = external_exports.string().superRefine((text, context) => {
|
|
14766
|
-
if (isRepoPathText({ text }) === "not-repo-path") {
|
|
14767
|
-
context.addIssue({ code: "custom", message: "not a repo-relative path" });
|
|
14768
|
-
}
|
|
14769
|
-
}).brand();
|
|
14524
|
+
context.addIssue({ code: "custom", message: request.refusal });
|
|
14525
|
+
return external_exports.NEVER;
|
|
14526
|
+
});
|
|
14770
14527
|
|
|
14771
14528
|
// core/values/identifiers.ts
|
|
14772
|
-
var
|
|
14773
|
-
var
|
|
14774
|
-
var
|
|
14775
|
-
var
|
|
14529
|
+
var RULE_SET_NAME_PATTERN = /^[a-z][a-z0-9-]*$/;
|
|
14530
|
+
var DISCIPLINE_ID_PATTERN = /^[A-Z]{2,4}-[0-9]+[a-z]?$/;
|
|
14531
|
+
var CLAUSE_ID_PATTERN = /^[a-z][a-z0-9-]*$/;
|
|
14532
|
+
var MECHANISM_ID_PATTERN = /^[a-z][a-z0-9-]*$/;
|
|
14533
|
+
var NOT_AN_IDENTIFIER = "not an identifier of its kind";
|
|
14534
|
+
var isRuleSetName = (text) => RULE_SET_NAME_PATTERN.test(text);
|
|
14535
|
+
var isDisciplineId = (text) => DISCIPLINE_ID_PATTERN.test(text);
|
|
14536
|
+
var isClauseId = (text) => CLAUSE_ID_PATTERN.test(text);
|
|
14537
|
+
var isMechanismId = (text) => MECHANISM_ID_PATTERN.test(text);
|
|
14538
|
+
var ruleSetNameSchema = brandedTextSchema({
|
|
14539
|
+
text: external_exports.string().regex(RULE_SET_NAME_PATTERN),
|
|
14540
|
+
isBranded: isRuleSetName,
|
|
14541
|
+
refusal: NOT_AN_IDENTIFIER
|
|
14542
|
+
});
|
|
14543
|
+
var disciplineIdSchema = brandedTextSchema({
|
|
14544
|
+
text: external_exports.string().regex(DISCIPLINE_ID_PATTERN),
|
|
14545
|
+
isBranded: isDisciplineId,
|
|
14546
|
+
refusal: NOT_AN_IDENTIFIER
|
|
14547
|
+
});
|
|
14548
|
+
var clauseIdSchema = brandedTextSchema({
|
|
14549
|
+
text: external_exports.string().regex(CLAUSE_ID_PATTERN),
|
|
14550
|
+
isBranded: isClauseId,
|
|
14551
|
+
refusal: NOT_AN_IDENTIFIER
|
|
14552
|
+
});
|
|
14553
|
+
var mechanismIdSchema = brandedTextSchema({
|
|
14554
|
+
text: external_exports.string().regex(MECHANISM_ID_PATTERN),
|
|
14555
|
+
isBranded: isMechanismId,
|
|
14556
|
+
refusal: NOT_AN_IDENTIFIER
|
|
14557
|
+
});
|
|
14558
|
+
|
|
14559
|
+
// core/values/tool-identity.ts
|
|
14560
|
+
var identified = (identity) => identity;
|
|
14561
|
+
var TOOL_IDENTITY = identified({
|
|
14562
|
+
name: "Hone",
|
|
14563
|
+
packageName: "@hailstails/hone",
|
|
14564
|
+
command: "hone",
|
|
14565
|
+
ownRuleSet: "hone",
|
|
14566
|
+
reservedEslintNamespace: "hone-core",
|
|
14567
|
+
description: "Checks a repository against the disciplines it selects, applies its recorded exceptions and prints one verdict.",
|
|
14568
|
+
repository: "https://github.com/HailsTails/hone",
|
|
14569
|
+
unrelatedNpmPackage: "hone"
|
|
14570
|
+
});
|
|
14776
14571
|
|
|
14777
14572
|
// core/values/clause-address.ts
|
|
14778
|
-
var
|
|
14573
|
+
var TOOL_RULE_SET = TOOL_IDENTITY.ownRuleSet;
|
|
14779
14574
|
var CLAUSE_ADDRESS_TEXT = /^(?:(?<ruleSet>[^/#]+)\/)?(?<discipline>[^/#]+)#(?<clause>[^/#]+)$/;
|
|
14780
14575
|
var clauseAddressObjectSchema = external_exports.object({
|
|
14781
14576
|
ruleSet: external_exports.union([
|
|
14782
|
-
external_exports.literal(
|
|
14577
|
+
external_exports.literal(TOOL_RULE_SET),
|
|
14783
14578
|
external_exports.object({
|
|
14784
|
-
name: ruleSetNameSchema.refine((name) => name !==
|
|
14579
|
+
name: ruleSetNameSchema.refine((name) => name !== TOOL_RULE_SET)
|
|
14785
14580
|
})
|
|
14786
14581
|
]),
|
|
14787
14582
|
discipline: disciplineIdSchema,
|
|
@@ -14797,113 +14592,25 @@ var clauseAddressSchema = external_exports.string().transform((text, context) =>
|
|
|
14797
14592
|
return external_exports.NEVER;
|
|
14798
14593
|
}
|
|
14799
14594
|
return {
|
|
14800
|
-
ruleSet: parts.ruleSet === void 0 ?
|
|
14595
|
+
ruleSet: parts.ruleSet === void 0 || parts.ruleSet === TOOL_RULE_SET ? TOOL_RULE_SET : { name: parts.ruleSet },
|
|
14801
14596
|
discipline: parts.discipline,
|
|
14802
14597
|
clause: parts.clause
|
|
14803
14598
|
};
|
|
14804
14599
|
}).pipe(clauseAddressObjectSchema);
|
|
14805
|
-
var clauseAddressText = (request) => request.address.ruleSet ===
|
|
14600
|
+
var clauseAddressText = (request) => request.address.ruleSet === TOOL_RULE_SET ? `${request.address.discipline}#${request.address.clause}` : `${request.address.ruleSet.name}/${request.address.discipline}#${request.address.clause}`;
|
|
14806
14601
|
var sameClauseAddress = (request) => clauseAddressText({ address: request.left }) === clauseAddressText({ address: request.right }) ? "same" : "different";
|
|
14807
14602
|
|
|
14808
|
-
// core/mechanism-port/toolchain-requirement.ts
|
|
14809
|
-
var RELEASE_PATTERN = /^(\d+)\.(\d+)\.(\d+)$/;
|
|
14810
|
-
var NOT_INSTALLED = "not installed";
|
|
14811
|
-
var MODULE_NOT_FOUND = "ERR_MODULE_NOT_FOUND";
|
|
14812
|
-
var BACKSLASH = /\\/g;
|
|
14813
|
-
var moduleErrorSchema = external_exports.object({ code: external_exports.string(), message: external_exports.string() });
|
|
14814
|
-
var releaseParts = (request) => {
|
|
14815
|
-
const match = RELEASE_PATTERN.exec(request.version);
|
|
14816
|
-
return match === null ? void 0 : [Number(match[1]), Number(match[2]), Number(match[3])];
|
|
14817
|
-
};
|
|
14818
|
-
var partsOrder = (request) => request.left[0] - request.right[0] || request.left[1] - request.right[1] || request.left[2] - request.right[2];
|
|
14819
|
-
var lineSupport = (request) => {
|
|
14820
|
-
const floor = releaseParts({ version: request.line.floor });
|
|
14821
|
-
const below = releaseParts({ version: request.line.below });
|
|
14822
|
-
return floor !== void 0 && below !== void 0 && partsOrder({ left: request.found, right: floor }) >= 0 && partsOrder({ left: request.found, right: below }) < 0 ? "supported" : "unsupported";
|
|
14823
|
-
};
|
|
14824
|
-
var versionSupport = (request) => {
|
|
14825
|
-
const found = releaseParts({ version: request.version });
|
|
14826
|
-
return found !== void 0 && request.requirement.lines.some((line) => lineSupport({ line, found }) === "supported") ? "supported" : "unsupported";
|
|
14827
|
-
};
|
|
14828
|
-
var lineRange = (request) => {
|
|
14829
|
-
const floor = releaseParts({ version: request.line.floor });
|
|
14830
|
-
return floor !== void 0 && request.line.below === `${floor[0] + 1}.0.0` ? `^${request.line.floor}` : `>=${request.line.floor} <${request.line.below}`;
|
|
14831
|
-
};
|
|
14832
|
-
var supportedRange = (request) => request.requirement.lines.map((line) => lineRange({ line })).join(" || ");
|
|
14833
|
-
var toolchainUnavailable = (request) => ({
|
|
14834
|
-
outcome: "failed",
|
|
14835
|
-
error: {
|
|
14836
|
-
kind: "toolchain-unavailable",
|
|
14837
|
-
packageName: request.requirement.packageName,
|
|
14838
|
-
peer: request.requirement.peer,
|
|
14839
|
-
supported: supportedRange({ requirement: request.requirement }),
|
|
14840
|
-
found: request.found
|
|
14841
|
-
}
|
|
14842
|
-
});
|
|
14843
|
-
var thrownState = (request) => {
|
|
14844
|
-
const parsed = moduleErrorSchema.safeParse(request.thrown);
|
|
14845
|
-
if (parsed.success && parsed.data.code === MODULE_NOT_FOUND && parsed.data.message.includes(`'${request.packageName}'`)) {
|
|
14846
|
-
return NOT_INSTALLED;
|
|
14847
|
-
}
|
|
14848
|
-
const detail = request.thrown instanceof Error ? request.thrown.message : String(request.thrown);
|
|
14849
|
-
return `unloadable: ${detail}`;
|
|
14850
|
-
};
|
|
14851
|
-
var slashed = (request) => request.path.replace(BACKSLASH, "/");
|
|
14852
|
-
var placementOf = (request) => slashed({ path: request.location }).startsWith(`${slashed({ path: request.installRoot })}/`) ? "inside-install" : "outside-install";
|
|
14853
|
-
var shadowingOf = (request) => request.location.installForm === "package" && placementOf({ location: request.resolved, installRoot: request.location.installRoot }) === "inside-install" ? "shadowed" : "unshadowed";
|
|
14854
|
-
var supportedPeer = (request) => versionSupport({ requirement: request.requirement, version: request.found.version }) === "supported" ? { outcome: "ok", value: request.found.loaded } : toolchainUnavailable({ requirement: request.requirement, found: request.found.version });
|
|
14855
|
-
var versionedPeer = (request) => Promise.resolve().then(request.load).then((loaded) => ({ loaded, version: request.versionOf(loaded) })).then(
|
|
14856
|
-
(found) => supportedPeer({ requirement: request.requirement, found }),
|
|
14857
|
-
(thrown) => toolchainUnavailable({
|
|
14858
|
-
requirement: request.requirement,
|
|
14859
|
-
found: thrownState({ thrown, packageName: request.requirement.packageName })
|
|
14860
|
-
})
|
|
14861
|
-
);
|
|
14862
|
-
var placedPeer = (request) => shadowingOf({ resolved: request.resolved, location: request.location }) === "shadowed" ? Promise.resolve({
|
|
14863
|
-
outcome: "failed",
|
|
14864
|
-
error: {
|
|
14865
|
-
kind: "toolchain-shadowed",
|
|
14866
|
-
packageName: request.requirement.packageName,
|
|
14867
|
-
location: request.resolved,
|
|
14868
|
-
installRoot: request.location.installRoot
|
|
14869
|
-
}
|
|
14870
|
-
}) : versionedPeer(request);
|
|
14871
|
-
var locatedPeer = (request) => request.located.outcome === "ok" ? placedPeer({ ...request, resolved: request.located.value }) : Promise.resolve(
|
|
14872
|
-
toolchainUnavailable({
|
|
14873
|
-
requirement: request.requirement,
|
|
14874
|
-
found: `unloadable: ${request.located.error.url} (${request.located.error.detail})`
|
|
14875
|
-
})
|
|
14876
|
-
);
|
|
14877
|
-
var loadedPeer = (request) => Promise.resolve().then(() => request.location.locate({ packageName: request.requirement.packageName })).then(
|
|
14878
|
-
(located) => locatedPeer({ ...request, located }),
|
|
14879
|
-
(thrown) => toolchainUnavailable({
|
|
14880
|
-
requirement: request.requirement,
|
|
14881
|
-
found: thrownState({ thrown, packageName: request.requirement.packageName })
|
|
14882
|
-
})
|
|
14883
|
-
);
|
|
14884
|
-
|
|
14885
14603
|
export {
|
|
14886
|
-
createDefaultFileTextPort,
|
|
14887
14604
|
external_exports,
|
|
14888
|
-
|
|
14889
|
-
|
|
14890
|
-
createDefaultModuleLoaderPort,
|
|
14891
|
-
absolutePathSchema,
|
|
14892
|
-
createDefaultPathPort,
|
|
14605
|
+
brandedTextSchema,
|
|
14606
|
+
TOOL_IDENTITY,
|
|
14893
14607
|
ruleSetNameSchema,
|
|
14894
14608
|
disciplineIdSchema,
|
|
14895
14609
|
clauseIdSchema,
|
|
14896
14610
|
mechanismIdSchema,
|
|
14611
|
+
TOOL_RULE_SET,
|
|
14897
14612
|
clauseAddressObjectSchema,
|
|
14898
14613
|
clauseAddressSchema,
|
|
14899
14614
|
clauseAddressText,
|
|
14900
|
-
sameClauseAddress
|
|
14901
|
-
NOT_INSTALLED,
|
|
14902
|
-
versionSupport,
|
|
14903
|
-
loadedPeer,
|
|
14904
|
-
installRootAboveEntry,
|
|
14905
|
-
moduleExtensionOf,
|
|
14906
|
-
installFormOf,
|
|
14907
|
-
runnerModuleSegmentsOf,
|
|
14908
|
-
moduleFileForm
|
|
14615
|
+
sameClauseAddress
|
|
14909
14616
|
};
|