@hailstails/hone 0.1.0-pre.4 → 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.
Files changed (45) hide show
  1. package/ADOPTING.md +37 -12
  2. package/MIGRATING.md +4 -4
  3. package/README.md +35 -16
  4. package/api/audit.d.ts +3 -2
  5. package/api/rule-set.d.ts +2 -4
  6. package/chunks/chunk-3HFJHJDO.js +53 -0
  7. package/chunks/chunk-7OVV6NEU.js +22 -0
  8. package/chunks/chunk-7PVPPH4C.js +13 -0
  9. package/chunks/chunk-HVABJ7T4.js +361 -0
  10. package/chunks/{chunk-BX6QHLSZ.js → chunk-IIMK5BCL.js} +57 -4
  11. package/chunks/{chunk-FOAGAYXM.js → chunk-SWPCKTJV.js} +44 -397
  12. package/chunks/{chunk-RZA3OVOO.js → chunk-VUG3DJHN.js} +5 -3
  13. package/chunks/{chunk-EYCRDEXX.js → chunk-YBWVUDIG.js} +2 -13
  14. package/core/check/tool-command.js +356 -81
  15. package/core/mechanism-port/piece-failure-types.d.ts +14 -0
  16. package/core/mechanism-port/runner-module-types.d.ts +5 -0
  17. package/core/rule-set-reader/authored-rule-set-types.d.ts +48 -0
  18. package/core/values/json-value.d.ts +3 -0
  19. package/docs/adding-a-discipline-or-mechanism.md +6 -3
  20. package/docs/extending.md +357 -0
  21. package/mechanisms/audit/CD-1/any-cast.js +9 -37
  22. package/mechanisms/audit/CD-19/import-boundaries.js +79 -68
  23. package/mechanisms/audit/CD-19/piece.json +5 -0
  24. package/mechanisms/audit/CD-2/cast-expressions.js +14 -37
  25. package/mechanisms/audit/CD-5/comments-directives.js +137 -55
  26. package/mechanisms/audit/CD-5/piece.json +7 -0
  27. package/mechanisms/audit/runner/README.md +1 -0
  28. package/mechanisms/audit/runner/runner.js +10 -6
  29. package/mechanisms/audit/runner/typescript-parse.d.ts +6 -0
  30. package/mechanisms/audit/runner/walker-piece.d.ts +5 -5
  31. package/mechanisms/eslint/runner/README.md +1 -1
  32. package/mechanisms/eslint/runner/runner.js +85 -35
  33. package/package.json +4 -4
  34. package/rules/CD-1/README.md +5 -5
  35. package/rules/CD-1/discipline.json +16 -6
  36. package/rules/CD-19/README.md +13 -3
  37. package/rules/CD-19/discipline.json +6 -8
  38. package/rules/CD-2/README.md +8 -4
  39. package/rules/CD-2/discipline.json +25 -7
  40. package/rules/CD-5/README.md +17 -5
  41. package/rules/CD-5/discipline.json +66 -0
  42. package/core/mechanism-port/runner-failure-types.d.ts +0 -38
  43. package/core/rule-set-reader/rule-set-types.d.ts +0 -41
  44. /package/api/{audit.js → audit.mjs} +0 -0
  45. /package/api/{rule-set.js → rule-set.mjs} +0 -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: () => process2,
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 process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
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
- process2(parent, ctx, params);
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
- process2(schema, ctx);
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
- process2(schema, ctx);
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 = process2(def.element, ctx, {
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] = process2(shape[key], ctx, {
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 = process2(def.catchall, ctx, {
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) => process2(x, ctx, {
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 = process2(def.left, ctx, {
12070
+ const a = process(def.left, ctx, {
12148
12071
  ...params,
12149
12072
  path: [...params.path, "allOf", 0]
12150
12073
  });
12151
- const b = process2(def.right, ctx, {
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) => process2(x, ctx, {
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 ? process2(def.rest, ctx, {
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 = process2(def.valueType, ctx, {
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 = process2(def.keyType, ctx, {
12145
+ json2.propertyNames = process(def.keyType, ctx, {
12223
12146
  ...params,
12224
12147
  path: [...params.path, "propertyNames"]
12225
12148
  });
12226
12149
  }
12227
- json2.additionalProperties = process2(def.valueType, ctx, {
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 = process2(def.innerType, ctx, params);
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
- process2(def.innerType, ctx, params);
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
- process2(def.innerType, ctx, params);
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
- process2(def.innerType, ctx, params);
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
- process2(def.innerType, ctx, params);
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
- process2(innerType, ctx, params);
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
- process2(def.innerType, ctx, params);
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
- process2(def.innerType, ctx, params);
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
- process2(def.innerType, ctx, params);
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
- process2(innerType, ctx, params);
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
- process2(schema, ctx2);
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
- process2(input, ctx);
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 process2(schema, this.ctx, _params);
12370
+ return process(schema, this.ctx, _params);
12448
12371
  }
12449
12372
  /**
12450
12373
  * Emit the final JSON Schema after processing.
@@ -14602,203 +14525,6 @@ var brandedTextSchema = (request) => request.text.transform((text, context) => {
14602
14525
  return external_exports.NEVER;
14603
14526
  });
14604
14527
 
14605
- // core/values/absolute-path.ts
14606
- var POSIX_ROOT_DRIVE_ROOT_OR_SHARE_ROOT = /^(?:\/|[A-Za-z]:[\\/]|\\\\[^\\/]+[\\/][^\\/]+[\\/])/;
14607
- var isAbsolutePath = (text) => POSIX_ROOT_DRIVE_ROOT_OR_SHARE_ROOT.test(text);
14608
- var absolutePathSchema = brandedTextSchema({
14609
- text: external_exports.string().regex(POSIX_ROOT_DRIVE_ROOT_OR_SHARE_ROOT),
14610
- isBranded: isAbsolutePath,
14611
- refusal: "not an absolute path"
14612
- });
14613
-
14614
- // core/platform-ports/path-port.ts
14615
- var notAFileUrl = (request) => ({
14616
- outcome: "failed",
14617
- error: { kind: "not-a-file-url", url: request.url, detail: request.detail }
14618
- });
14619
- var absolutePathOfFileUrl = (request) => {
14620
- try {
14621
- const parsed = absolutePathSchema.safeParse(
14622
- fileURLToPath(request.url, { windows: request.surface === win32 })
14623
- );
14624
- if (!parsed.success) {
14625
- return notAFileUrl({ url: request.url, detail: "the file URL names no absolute path" });
14626
- }
14627
- return { outcome: "ok", value: parsed.data };
14628
- } catch (thrown) {
14629
- return notAFileUrl({
14630
- url: request.url,
14631
- detail: thrown instanceof Error ? thrown.message : String(thrown)
14632
- });
14633
- }
14634
- };
14635
- var absolutePathOf = (request) => {
14636
- const parsed = absolutePathSchema.safeParse(request.resolved);
14637
- if (!parsed.success) {
14638
- return { outcome: "failed", error: { kind: "working-directory-unusable", path: request.path } };
14639
- }
14640
- return { outcome: "ok", value: parsed.data };
14641
- };
14642
- var fileUrlForm = (request) => URL.canParse(request.url) && new URL(request.url).protocol === "file:" ? "file-url" : "not-a-file-url";
14643
- var UNREADABLE_WORKING_DIRECTORY = "";
14644
- var REPOSITORY_SEPARATOR = "/";
14645
- var WINDOWS_ANCHOR_ROOT = "C:\\";
14646
- var anchorRootOf = (request) => request.surface === win32 ? WINDOWS_ANCHOR_ROOT : request.surface.sep;
14647
- var workingDirectoryText = (request) => {
14648
- try {
14649
- return request.workingDirectory({});
14650
- } catch {
14651
- return UNREADABLE_WORKING_DIRECTORY;
14652
- }
14653
- };
14654
- var rootOf = (request) => request.surface.parse(request.path).root.toLowerCase();
14655
- var DRIVE_LESS_ROOTS = ["\\", "/"];
14656
- var rootFormOf = (request) => {
14657
- const root = request.surface.parse(request.path).root;
14658
- if (root === "") {
14659
- return "relative";
14660
- }
14661
- if (request.surface === win32 && DRIVE_LESS_ROOTS.includes(root)) {
14662
- return "rooted-without-drive";
14663
- }
14664
- return request.surface.isAbsolute(request.path) ? "fully-rooted" : "drive-relative";
14665
- };
14666
- var workingDirectoryReadingOf = (request) => {
14667
- const directory = workingDirectoryText(request);
14668
- return rootFormOf({ path: directory, surface: request.surface }) === "fully-rooted" ? { usability: "usable", directory } : { usability: "unusable" };
14669
- };
14670
- var driveRelationOf = (request) => request.reading.usability === "usable" && rootOf({ path: request.reading.directory, surface: request.surface }).startsWith(request.driveRoot.toLowerCase()) ? "same-drive" : "another-drive";
14671
- var driveRelativeFormOf = (request) => {
14672
- const driveRoot = request.surface.parse(request.path).root;
14673
- const reading = workingDirectoryReadingOf(request);
14674
- if (reading.usability === "unusable" || driveRelationOf({ driveRoot, reading, surface: request.surface }) === "another-drive") {
14675
- return request.surface.resolve(`${driveRoot}${request.surface.sep}`, request.path);
14676
- }
14677
- return request.surface.resolve(reading.directory, request.path);
14678
- };
14679
- var rootedWithoutDriveFormOf = (request) => {
14680
- const reading = workingDirectoryReadingOf(request);
14681
- if (reading.usability === "unusable") {
14682
- return request.surface.normalize(request.path);
14683
- }
14684
- return request.surface.resolve(request.surface.parse(reading.directory).root, request.path);
14685
- };
14686
- var relativeFormOf = (request) => {
14687
- const reading = workingDirectoryReadingOf(request);
14688
- if (reading.usability === "unusable") {
14689
- return request.surface.normalize(request.path);
14690
- }
14691
- return request.surface.resolve(reading.directory, request.path);
14692
- };
14693
- var absoluteFormOf = (request) => {
14694
- const rootForm = rootFormOf(request);
14695
- switch (rootForm) {
14696
- case "fully-rooted":
14697
- return request.surface.normalize(request.path);
14698
- case "rooted-without-drive":
14699
- return rootedWithoutDriveFormOf(request);
14700
- case "drive-relative":
14701
- return driveRelativeFormOf(request);
14702
- case "relative":
14703
- return relativeFormOf(request);
14704
- }
14705
- };
14706
- var driveFormOf = (request) => request.surface === win32 && rootFormOf(request) === "fully-rooted" ? "drive-carrying" : "drive-less";
14707
- var relativeLocationBetween = (request) => {
14708
- const fromDriveForm = driveFormOf({ path: request.from, surface: request.surface });
14709
- if (fromDriveForm !== driveFormOf({ path: request.to, surface: request.surface })) {
14710
- return { relation: "different-root" };
14711
- }
14712
- if (fromDriveForm === "drive-carrying") {
14713
- return relativeLocationOf(request);
14714
- }
14715
- const anchorRoot = anchorRootOf(request);
14716
- return relativeLocationOf({
14717
- surface: request.surface,
14718
- from: request.surface.resolve(anchorRoot, request.from),
14719
- to: request.surface.resolve(anchorRoot, request.to)
14720
- });
14721
- };
14722
- var relativeLocationOf = (request) => rootOf({ path: request.from, surface: request.surface }) === rootOf({ path: request.to, surface: request.surface }) ? {
14723
- relation: "within-root",
14724
- path: repositoryFormOf({ surface: request.surface, path: request.surface.relative(request.from, request.to) })
14725
- } : { relation: "different-root" };
14726
- var repositoryFormOf = (request) => request.path.split(request.surface.sep).join(REPOSITORY_SEPARATOR);
14727
- var surfaceOf = (request) => {
14728
- switch (request.flavour) {
14729
- case "posix":
14730
- return posix;
14731
- case "windows":
14732
- return win32;
14733
- case "platform":
14734
- return platformPath;
14735
- }
14736
- };
14737
- var portOver = (options) => ({
14738
- join: (request) => options.surface.join(...request.segments),
14739
- joinRepository: (request) => posix.join(...request.segments),
14740
- relative: (request) => relativeLocationBetween({
14741
- surface: options.surface,
14742
- from: absoluteFormOf({ path: request.from, surface: options.surface, workingDirectory: options.workingDirectory }),
14743
- to: absoluteFormOf({ path: request.to, surface: options.surface, workingDirectory: options.workingDirectory })
14744
- }),
14745
- directoryOf: (request) => options.surface.dirname(request.path),
14746
- repositoryDirectoryOf: (request) => posix.dirname(request.path),
14747
- resolve: (request) => absolutePathOf({
14748
- path: request.path,
14749
- resolved: absoluteFormOf({ path: request.path, surface: options.surface, workingDirectory: options.workingDirectory })
14750
- }),
14751
- 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 })
14752
- });
14753
- var createPathPort = (options) => portOver({ surface: surfaceOf({ flavour: options.flavour }), workingDirectory: options.workingDirectory });
14754
- var defaultWorkingDirectory = () => process.cwd();
14755
- var createDefaultPathPort = (_options) => createPathPort({ flavour: "platform", workingDirectory: defaultWorkingDirectory });
14756
-
14757
- // core/values/install-layout.ts
14758
- var FOLDERS_BETWEEN_INSTALL_ROOT_AND_ENTRY = {
14759
- command: 2,
14760
- runner: 3
14761
- };
14762
- var installRootAboveEntry = (request) => Array.from({ length: FOLDERS_BETWEEN_INSTALL_ROOT_AND_ENTRY[request.entry] + 1 }).reduce(
14763
- (path) => request.directoryOf(path),
14764
- request.entryFile
14765
- );
14766
- var BUILT_MODULE_EXTENSION = ".js";
14767
- var SOURCE_MODULE_EXTENSION = ".ts";
14768
- var moduleExtensionOf = (request) => new URL(request.moduleUrl).pathname.endsWith(BUILT_MODULE_EXTENSION) ? BUILT_MODULE_EXTENSION : SOURCE_MODULE_EXTENSION;
14769
- var installFormOf = (request) => request.moduleExtension === BUILT_MODULE_EXTENSION ? "package" : "source";
14770
- var runnerModuleSegmentsOf = (request) => [request.installRoot, "mechanisms", request.mechanism, "runner", `runner${request.moduleExtension}`];
14771
- var MODULE_EXTENSIONS = [SOURCE_MODULE_EXTENSION, BUILT_MODULE_EXTENSION];
14772
- var moduleFileForm = (request) => MODULE_EXTENSIONS.some((extension) => request.text.endsWith(extension)) ? "module-file" : "not-module-file";
14773
-
14774
- // core/values/repo-path.ts
14775
- var UNWALKABLE_SEGMENTS = ["", ".", ".."];
14776
- var LEADING_DRIVE_LETTER = /^[A-Za-z]:/;
14777
- var LINE_BREAK_OR_NUL = /[\n\r\0]/;
14778
- var NOT_A_REPO_PATH = "not a repo-relative path";
14779
- 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";
14780
- var isRepoPath = (text) => isRepoPathText({ text }) === "repo-path";
14781
- var repoPathTextSchema = external_exports.string().superRefine((text, context) => {
14782
- if (isRepoPathText({ text }) === "not-repo-path") {
14783
- context.addIssue({ code: "custom", message: NOT_A_REPO_PATH });
14784
- }
14785
- });
14786
- var brandedRepoPathSchema = (request) => brandedTextSchema({ text: request.text, isBranded: isRepoPath, refusal: NOT_A_REPO_PATH });
14787
- var repoPathSchema = brandedRepoPathSchema({ text: repoPathTextSchema });
14788
-
14789
- // core/values/tool-identity.ts
14790
- var identified = (identity) => identity;
14791
- var TOOL_IDENTITY = identified({
14792
- name: "Hone",
14793
- packageName: "@hailstails/hone",
14794
- command: "hone",
14795
- ownRuleSet: "hone",
14796
- reservedEslintNamespace: "hone-core",
14797
- description: "Checks a repository against the disciplines it selects, applies its recorded exceptions and prints one verdict.",
14798
- repository: "https://github.com/HailsTails/hone",
14799
- unrelatedNpmPackage: "hone"
14800
- });
14801
-
14802
14528
  // core/values/identifiers.ts
14803
14529
  var RULE_SET_NAME_PATTERN = /^[a-z][a-z0-9-]*$/;
14804
14530
  var DISCIPLINE_ID_PATTERN = /^[A-Z]{2,4}-[0-9]+[a-z]?$/;
@@ -14830,6 +14556,19 @@ var mechanismIdSchema = brandedTextSchema({
14830
14556
  refusal: NOT_AN_IDENTIFIER
14831
14557
  });
14832
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
+ });
14571
+
14833
14572
  // core/values/clause-address.ts
14834
14573
  var TOOL_RULE_SET = TOOL_IDENTITY.ownRuleSet;
14835
14574
  var CLAUSE_ADDRESS_TEXT = /^(?:(?<ruleSet>[^/#]+)\/)?(?<discipline>[^/#]+)#(?<clause>[^/#]+)$/;
@@ -14861,93 +14600,9 @@ var clauseAddressSchema = external_exports.string().transform((text, context) =>
14861
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}`;
14862
14601
  var sameClauseAddress = (request) => clauseAddressText({ address: request.left }) === clauseAddressText({ address: request.right }) ? "same" : "different";
14863
14602
 
14864
- // core/mechanism-port/toolchain-requirement.ts
14865
- var RELEASE_PATTERN = /^(\d+)\.(\d+)\.(\d+)$/;
14866
- var NOT_INSTALLED = "not installed";
14867
- var MODULE_NOT_FOUND = "ERR_MODULE_NOT_FOUND";
14868
- var BACKSLASH = /\\/g;
14869
- var moduleErrorSchema = external_exports.object({ code: external_exports.string(), message: external_exports.string() });
14870
- var releaseParts = (request) => {
14871
- const match = RELEASE_PATTERN.exec(request.version);
14872
- return match === null ? void 0 : [Number(match[1]), Number(match[2]), Number(match[3])];
14873
- };
14874
- var partsOrder = (request) => request.left[0] - request.right[0] || request.left[1] - request.right[1] || request.left[2] - request.right[2];
14875
- var lineSupport = (request) => {
14876
- const floor = releaseParts({ version: request.line.floor });
14877
- const below = releaseParts({ version: request.line.below });
14878
- return floor !== void 0 && below !== void 0 && partsOrder({ left: request.found, right: floor }) >= 0 && partsOrder({ left: request.found, right: below }) < 0 ? "supported" : "unsupported";
14879
- };
14880
- var versionSupport = (request) => {
14881
- const found = releaseParts({ version: request.version });
14882
- return found !== void 0 && request.requirement.lines.some((line) => lineSupport({ line, found }) === "supported") ? "supported" : "unsupported";
14883
- };
14884
- var lineRange = (request) => {
14885
- const floor = releaseParts({ version: request.line.floor });
14886
- return floor !== void 0 && request.line.below === `${floor[0] + 1}.0.0` ? `^${request.line.floor}` : `>=${request.line.floor} <${request.line.below}`;
14887
- };
14888
- var supportedRange = (request) => request.requirement.lines.map((line) => lineRange({ line })).join(" || ");
14889
- var toolchainUnavailable = (request) => ({
14890
- outcome: "failed",
14891
- error: {
14892
- kind: "toolchain-unavailable",
14893
- packageName: request.requirement.packageName,
14894
- peer: request.requirement.peer,
14895
- supported: supportedRange({ requirement: request.requirement }),
14896
- found: request.found
14897
- }
14898
- });
14899
- var thrownState = (request) => {
14900
- const parsed = moduleErrorSchema.safeParse(request.thrown);
14901
- if (parsed.success && parsed.data.code === MODULE_NOT_FOUND && parsed.data.message.includes(`'${request.packageName}'`)) {
14902
- return NOT_INSTALLED;
14903
- }
14904
- const detail = request.thrown instanceof Error ? request.thrown.message : String(request.thrown);
14905
- return `unloadable: ${detail}`;
14906
- };
14907
- var slashed = (request) => request.path.replace(BACKSLASH, "/");
14908
- var placementOf = (request) => slashed({ path: request.location }).startsWith(`${slashed({ path: request.installRoot })}/`) ? "inside-install" : "outside-install";
14909
- var shadowingOf = (request) => request.location.installForm === "package" && placementOf({ location: request.resolved, installRoot: request.location.installRoot }) === "inside-install" ? "shadowed" : "unshadowed";
14910
- 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 });
14911
- var versionedPeer = (request) => Promise.resolve().then(request.load).then((loaded) => ({ loaded, version: request.versionOf(loaded) })).then(
14912
- (found) => supportedPeer({ requirement: request.requirement, found }),
14913
- (thrown) => toolchainUnavailable({
14914
- requirement: request.requirement,
14915
- found: thrownState({ thrown, packageName: request.requirement.packageName })
14916
- })
14917
- );
14918
- var placedPeer = (request) => shadowingOf({ resolved: request.resolved, location: request.location }) === "shadowed" ? Promise.resolve({
14919
- outcome: "failed",
14920
- error: {
14921
- kind: "toolchain-shadowed",
14922
- packageName: request.requirement.packageName,
14923
- location: request.resolved,
14924
- installRoot: request.location.installRoot
14925
- }
14926
- }) : versionedPeer(request);
14927
- var locatedPeer = (request) => request.located.outcome === "ok" ? placedPeer({ ...request, resolved: request.located.value }) : Promise.resolve(
14928
- toolchainUnavailable({
14929
- requirement: request.requirement,
14930
- found: `unloadable: ${request.located.error.url} (${request.located.error.detail})`
14931
- })
14932
- );
14933
- var loadedPeer = (request) => Promise.resolve().then(() => request.location.locate({ packageName: request.requirement.packageName })).then(
14934
- (located) => locatedPeer({ ...request, located }),
14935
- (thrown) => toolchainUnavailable({
14936
- requirement: request.requirement,
14937
- found: thrownState({ thrown, packageName: request.requirement.packageName })
14938
- })
14939
- );
14940
-
14941
14603
  export {
14942
- createDefaultFileTextPort,
14943
14604
  external_exports,
14944
- isRepoPathText,
14945
- repoPathTextSchema,
14946
- brandedRepoPathSchema,
14947
- repoPathSchema,
14948
- createDefaultModuleLoaderPort,
14949
- absolutePathSchema,
14950
- createDefaultPathPort,
14605
+ brandedTextSchema,
14951
14606
  TOOL_IDENTITY,
14952
14607
  ruleSetNameSchema,
14953
14608
  disciplineIdSchema,
@@ -14957,13 +14612,5 @@ export {
14957
14612
  clauseAddressObjectSchema,
14958
14613
  clauseAddressSchema,
14959
14614
  clauseAddressText,
14960
- sameClauseAddress,
14961
- NOT_INSTALLED,
14962
- versionSupport,
14963
- loadedPeer,
14964
- installRootAboveEntry,
14965
- moduleExtensionOf,
14966
- installFormOf,
14967
- runnerModuleSegmentsOf,
14968
- moduleFileForm
14615
+ sameClauseAddress
14969
14616
  };
@@ -1,8 +1,10 @@
1
1
  import {
2
- clauseAddressObjectSchema,
3
- external_exports,
4
2
  repoPathSchema
5
- } from "./chunk-FOAGAYXM.js";
3
+ } from "./chunk-HVABJ7T4.js";
4
+ import {
5
+ clauseAddressObjectSchema,
6
+ external_exports
7
+ } from "./chunk-SWPCKTJV.js";
6
8
 
7
9
  // core/values/anchor-schema.ts
8
10
  var anchorSchema = external_exports.object({