@hailstails/hone 0.1.0-pre.7 → 0.1.0-pre.9
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 +27 -11
- package/CHANGELOG.md +136 -0
- package/MIGRATING.md +55 -16
- package/README.md +10 -9
- package/api/audit.js +0 -1
- package/api/testing.js +8 -9
- package/chunks/chunk-5X2BR42Y.js +117 -0
- package/chunks/{chunk-NRXSM7BY.js → chunk-LHVFZMXD.js} +10 -7
- package/chunks/{chunk-5LCLBXP7.js → chunk-NILRE23T.js} +1 -1
- package/chunks/{chunk-P3NLETF5.js → chunk-OKQHVZLO.js} +1 -1
- package/chunks/{chunk-POZL7G62.js → chunk-OVEQ37JQ.js} +40 -37
- package/chunks/chunk-RNXPEK2U.js +77 -0
- package/chunks/{chunk-3LCKBX5T.js → chunk-XE6RNNZB.js} +205 -148
- package/chunks/{chunk-WPRR2MPJ.js → chunk-YL6WR3QW.js} +5 -5
- package/core/check/tool-command.js +57 -36
- package/docs/extending.md +2 -0
- package/docs/output-contract.md +4 -4
- package/mechanisms/audit/CD-1/any-cast.js +0 -1
- package/mechanisms/audit/CD-10/throws-in-tests.js +0 -1
- package/mechanisms/audit/CD-14/class-syntax.js +0 -1
- package/mechanisms/audit/CD-15/loops.js +0 -1
- package/mechanisms/audit/CD-17/clock-sources.js +0 -1
- package/mechanisms/audit/CD-19/import-boundaries.js +3 -4
- package/mechanisms/audit/CD-2/cast-expressions.js +0 -1
- package/mechanisms/audit/CD-23/export-test-sibling.js +0 -1
- package/mechanisms/audit/CD-25/dependency-isolation.js +0 -1
- package/mechanisms/audit/CD-26/module-mocking.js +0 -1
- package/mechanisms/audit/CD-27/test-body-logic.js +0 -1
- package/mechanisms/audit/CD-3/compiler-overrides.js +2 -861
- package/mechanisms/audit/CD-43/boolean-signatures.js +0 -1
- package/mechanisms/audit/CD-44/parameter-mutation.js +0 -1
- package/mechanisms/audit/CD-47/hermetic-git-spawns.js +0 -1
- package/mechanisms/audit/CD-5/comments-directives.js +3 -4
- package/mechanisms/audit/CD-6/identifier-names.js +0 -1
- package/mechanisms/audit/CD-7/categorical-paths.js +0 -1
- package/mechanisms/audit/CD-7a/factory-return-types.js +0 -1
- package/mechanisms/audit/CD-8/switch-defaults.js +0 -1
- package/mechanisms/audit/runner/README.md +2 -2
- package/mechanisms/audit/runner/runner.js +31 -27
- package/mechanisms/eslint/CD-1/cd1/cd1.eslint-plugin.js +0 -1
- package/mechanisms/eslint/CD-10/cd10/cd10.eslint-plugin.js +0 -2
- package/mechanisms/eslint/CD-14/cd14/cd14.eslint-plugin.js +0 -1
- package/mechanisms/eslint/CD-2/cd2/cd2.eslint-plugin.js +0 -1
- package/mechanisms/eslint/CD-27/cd27/cd27.eslint-plugin.js +0 -2
- package/mechanisms/eslint/CD-40/cd40/cd40.eslint-plugin.js +0 -1
- package/mechanisms/eslint/CD-41/cd41/cd41.eslint-plugin.js +0 -2
- package/mechanisms/eslint/CD-42/cd42/cd42.eslint-plugin.js +0 -2
- package/mechanisms/eslint/CD-44/cd44/cd44.eslint-plugin.js +0 -1
- package/mechanisms/eslint/CD-6/cd6/cd6.eslint-plugin.js +0 -1
- package/mechanisms/eslint/CD-7/cd7/cd7.eslint-plugin.js +0 -2
- package/mechanisms/eslint/runner/README.md +1 -1
- package/mechanisms/eslint/runner/runner.js +58 -2532
- package/package.json +7 -2
- package/rules/CD-10/CHECKS.md +2 -2
- package/rules/CD-14/CHECKS.md +2 -2
- package/rules/CD-15/CHECKS.md +2 -2
- package/rules/CD-17/CHECKS.md +2 -2
- package/rules/CD-19/CHECKS.md +2 -2
- package/rules/CD-2/CHECKS.md +2 -2
- package/rules/CD-23/CHECKS.md +2 -2
- package/rules/CD-25/CHECKS.md +2 -2
- package/rules/CD-26/CHECKS.md +2 -2
- package/rules/CD-27/CHECKS.md +2 -2
- package/rules/CD-3/CHECKS.md +2 -2
- package/rules/CD-40/CHECKS.md +2 -2
- package/rules/CD-41/CHECKS.md +2 -2
- package/rules/CD-42/CHECKS.md +2 -2
- package/rules/CD-43/CHECKS.md +2 -2
- package/rules/CD-44/CHECKS.md +2 -2
- package/rules/CD-47/CHECKS.md +2 -2
- package/rules/CD-5/CHECKS.md +2 -2
- package/rules/CD-6/CHECKS.md +2 -2
- package/rules/CD-7/CHECKS.md +2 -2
- package/rules/CD-7a/CHECKS.md +2 -2
- package/rules/CD-8/CHECKS.md +2 -2
- package/THIRD-PARTY-NOTICES.md +0 -354
- package/chunks/chunk-MYX7GAVM.js +0 -73
- package/chunks/chunk-NCDYOPHG.js +0 -19832
- package/chunks/chunk-NZLE2WMY.js +0 -35
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
|
-
clauseAddressText
|
|
3
|
-
|
|
4
|
-
} from "./chunk-NCDYOPHG.js";
|
|
2
|
+
clauseAddressText
|
|
3
|
+
} from "./chunk-5X2BR42Y.js";
|
|
5
4
|
|
|
6
5
|
// mechanisms/audit/runner/piece-clause-settings.ts
|
|
6
|
+
import { z } from "zod";
|
|
7
7
|
var stringListClauseSettings = (request) => {
|
|
8
|
-
const parsed =
|
|
8
|
+
const parsed = z.record(z.enum(request.keys), z.array(z.string().min(1)).readonly()).safeParse(request.clause.clauseSettings);
|
|
9
9
|
if (parsed.success) return { outcome: "ok", value: parsed.data };
|
|
10
10
|
return {
|
|
11
11
|
outcome: "failed",
|
|
12
12
|
error: {
|
|
13
13
|
kind: "piece-invalid",
|
|
14
14
|
pieceRoot: request.clause.pieceRoot,
|
|
15
|
-
detail: `the clauseSettings of ${clauseAddressText({ address: request.clause.address })} are malformed: ${
|
|
15
|
+
detail: `the clauseSettings of ${clauseAddressText({ address: request.clause.address })} are malformed: ${z.prettifyError(parsed.error)}`
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
18
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
ASSESSMENT_FILE_NAME,
|
|
4
|
+
UNLINKED,
|
|
4
5
|
UNMEASURED_EXCEPTION_BASELINE,
|
|
5
6
|
WAIVED_CLAUSES_REPLACEMENT,
|
|
6
7
|
allOk,
|
|
@@ -11,6 +12,7 @@ import {
|
|
|
11
12
|
installRootOf,
|
|
12
13
|
loadFailureText,
|
|
13
14
|
loadInputs,
|
|
15
|
+
packageLinkOf,
|
|
14
16
|
projectMechanism,
|
|
15
17
|
readRunSettings,
|
|
16
18
|
recordImportOf,
|
|
@@ -21,40 +23,39 @@ import {
|
|
|
21
23
|
runCheck,
|
|
22
24
|
runnerFailed,
|
|
23
25
|
shownFailureOf
|
|
24
|
-
} from "../../chunks/chunk-
|
|
25
|
-
import "../../chunks/chunk-
|
|
26
|
+
} from "../../chunks/chunk-XE6RNNZB.js";
|
|
27
|
+
import "../../chunks/chunk-RNXPEK2U.js";
|
|
26
28
|
import {
|
|
27
29
|
parsedJson
|
|
28
|
-
} from "../../chunks/chunk-
|
|
30
|
+
} from "../../chunks/chunk-OVEQ37JQ.js";
|
|
29
31
|
import {
|
|
30
32
|
createDefaultFileTextPort,
|
|
31
33
|
createDefaultModuleLoaderPort,
|
|
32
34
|
createDefaultPathPort,
|
|
33
35
|
moduleExtensionOf,
|
|
34
36
|
repoPathSchema
|
|
35
|
-
} from "../../chunks/chunk-
|
|
37
|
+
} from "../../chunks/chunk-LHVFZMXD.js";
|
|
36
38
|
import {
|
|
37
39
|
TOOL_IDENTITY,
|
|
38
|
-
clauseAddressText
|
|
39
|
-
|
|
40
|
-
} from "../../chunks/chunk-NCDYOPHG.js";
|
|
41
|
-
import "../../chunks/chunk-NZLE2WMY.js";
|
|
40
|
+
clauseAddressText
|
|
41
|
+
} from "../../chunks/chunk-5X2BR42Y.js";
|
|
42
42
|
|
|
43
43
|
// core/platform-ports/execution-port.ts
|
|
44
44
|
import { spawnSync } from "node:child_process";
|
|
45
|
-
|
|
46
|
-
var
|
|
47
|
-
var
|
|
48
|
-
|
|
45
|
+
import { z } from "zod";
|
|
46
|
+
var executionEnvironmentSchema = z.record(z.string(), z.string().optional()).readonly();
|
|
47
|
+
var positiveSafeIntegerSchema = z.number().int().positive().max(Number.MAX_SAFE_INTEGER);
|
|
48
|
+
var capturedPolicySchema = z.object({
|
|
49
|
+
executable: z.string().min(1),
|
|
49
50
|
environment: executionEnvironmentSchema,
|
|
50
51
|
timeoutMilliseconds: positiveSafeIntegerSchema.optional(),
|
|
51
52
|
maximumOutputBytes: positiveSafeIntegerSchema
|
|
52
53
|
}).readonly();
|
|
53
|
-
var hostDiagnosticsSchema =
|
|
54
|
-
stdout:
|
|
55
|
-
stderr:
|
|
56
|
-
code:
|
|
57
|
-
signal:
|
|
54
|
+
var hostDiagnosticsSchema = z.object({
|
|
55
|
+
stdout: z.string().catch(""),
|
|
56
|
+
stderr: z.string().catch(""),
|
|
57
|
+
code: z.string().optional().catch(void 0),
|
|
58
|
+
signal: z.string().optional().catch(void 0)
|
|
58
59
|
});
|
|
59
60
|
var EMPTY_DIAGNOSTICS = { stdout: "", stderr: "", code: void 0, signal: void 0 };
|
|
60
61
|
var failedExecution = (error) => ({ outcome: "failed", error });
|
|
@@ -123,7 +124,7 @@ var bindPolicy = (options) => {
|
|
|
123
124
|
try {
|
|
124
125
|
const parsedAmbient = executionEnvironmentSchema.safeParse(options.ambientEnvironment);
|
|
125
126
|
if (!parsedAmbient.success) {
|
|
126
|
-
return failedExecution({ ...EMPTY_DIAGNOSTICS, kind: "policy-invalid", detail:
|
|
127
|
+
return failedExecution({ ...EMPTY_DIAGNOSTICS, kind: "policy-invalid", detail: z.prettifyError(parsedAmbient.error) });
|
|
127
128
|
}
|
|
128
129
|
const { executable, environment, timeoutMilliseconds, maximumOutputBytes } = options.policy;
|
|
129
130
|
const parsedPolicy = capturedPolicySchema.safeParse({
|
|
@@ -132,7 +133,7 @@ var bindPolicy = (options) => {
|
|
|
132
133
|
timeoutMilliseconds,
|
|
133
134
|
maximumOutputBytes
|
|
134
135
|
});
|
|
135
|
-
return parsedPolicy.success ? { outcome: "ok", value: parsedPolicy.data } : failedExecution({ ...EMPTY_DIAGNOSTICS, kind: "policy-invalid", detail:
|
|
136
|
+
return parsedPolicy.success ? { outcome: "ok", value: parsedPolicy.data } : failedExecution({ ...EMPTY_DIAGNOSTICS, kind: "policy-invalid", detail: z.prettifyError(parsedPolicy.error) });
|
|
136
137
|
} catch (thrown) {
|
|
137
138
|
return failedExecution({ ...EMPTY_DIAGNOSTICS, kind: "policy-invalid", detail: failureDetail({ thrown }) });
|
|
138
139
|
}
|
|
@@ -467,6 +468,7 @@ var argumentsInvalid = (request) => ({
|
|
|
467
468
|
// core/check/command-arguments.ts
|
|
468
469
|
var FLAG_MARKER = "-";
|
|
469
470
|
var JOINED_VALUE_MARKER = "=";
|
|
471
|
+
var END_OF_OPTIONS = "--";
|
|
470
472
|
var REMOVED_OPTIONS = /* @__PURE__ */ new Map([["--waived-clauses", WAIVED_CLAUSES_REPLACEMENT]]);
|
|
471
473
|
var failedWith = (request) => argumentsInvalid(request);
|
|
472
474
|
var optionNamed = (request) => COMMANDS[request.subcommand].options.find((option) => option.name === request.given);
|
|
@@ -499,12 +501,27 @@ var optionValuesFrom = (request) => {
|
|
|
499
501
|
}
|
|
500
502
|
return optionValuesFrom({ ...request, remaining: rest, given: new Map([...request.given, [option.name, given]]) });
|
|
501
503
|
};
|
|
504
|
+
var withoutEndOfOptions = (request) => {
|
|
505
|
+
const [name, ...rest] = request.remaining;
|
|
506
|
+
if (name === void 0) {
|
|
507
|
+
return [];
|
|
508
|
+
}
|
|
509
|
+
if (name === END_OF_OPTIONS) {
|
|
510
|
+
return withoutEndOfOptions({ remaining: rest });
|
|
511
|
+
}
|
|
512
|
+
const [given, ...beyond] = rest;
|
|
513
|
+
return given === void 0 ? [name] : [name, given, ...withoutEndOfOptions({ remaining: beyond })];
|
|
514
|
+
};
|
|
502
515
|
var givenOptionValues = (request) => {
|
|
503
516
|
const removed = removedOptionProblem(request);
|
|
504
517
|
if (removed !== void 0) {
|
|
505
518
|
return failedWith({ problem: removed });
|
|
506
519
|
}
|
|
507
|
-
return optionValuesFrom({
|
|
520
|
+
return optionValuesFrom({
|
|
521
|
+
subcommand: request.subcommand,
|
|
522
|
+
remaining: withoutEndOfOptions({ remaining: request.arguments }),
|
|
523
|
+
given: /* @__PURE__ */ new Map()
|
|
524
|
+
});
|
|
508
525
|
};
|
|
509
526
|
var requiredRepo = (request) => {
|
|
510
527
|
const repo = request.values.get(REPO_OPTION.name);
|
|
@@ -553,7 +570,7 @@ var parseProjectArguments = (request) => {
|
|
|
553
570
|
const repo = requiredRepo({ subcommand: "project", values: values.value });
|
|
554
571
|
return repo.outcome === "failed" ? repo : { outcome: "ok", value: { repo: repo.value } };
|
|
555
572
|
};
|
|
556
|
-
var optionNamePositions = (request) => request.arguments.filter((_, position) => position % 2 === 0);
|
|
573
|
+
var optionNamePositions = (request) => withoutEndOfOptions({ remaining: request.arguments }).filter((_, position) => position % 2 === 0);
|
|
557
574
|
var asksForHelp = (request) => optionNamePositions(request).some((argument) => HELP_FLAGS.includes(argument)) ? "help" : "no-help";
|
|
558
575
|
var toolFlagOf = (request) => {
|
|
559
576
|
if (request.given !== void 0 && HELP_FLAGS.includes(request.given)) {
|
|
@@ -945,8 +962,9 @@ var versionCommandOutcome = (request) => request.result.outcome === "failed" ? l
|
|
|
945
962
|
` };
|
|
946
963
|
|
|
947
964
|
// core/check/installed-version.ts
|
|
965
|
+
import { z as z2 } from "zod";
|
|
948
966
|
var PACKAGE_MANIFEST = "package.json";
|
|
949
|
-
var versionedManifestSchema =
|
|
967
|
+
var versionedManifestSchema = z2.looseObject({ version: z2.string() });
|
|
950
968
|
var malformed = (request) => ({
|
|
951
969
|
outcome: "failed",
|
|
952
970
|
error: { kind: "file-malformed", path: request.path, detail: request.detail }
|
|
@@ -970,7 +988,7 @@ var versionAt = (request) => {
|
|
|
970
988
|
};
|
|
971
989
|
var installedVersionOf = (request) => {
|
|
972
990
|
const version = versionAt(request);
|
|
973
|
-
return version.outcome === "failed" ? { outcome: "failed", error: shownFailureOf({ failure: version.error, path: request.path, repoRoot: void 0 }) } : version;
|
|
991
|
+
return version.outcome === "failed" ? { outcome: "failed", error: shownFailureOf({ failure: version.error, path: request.path, repoRoot: void 0, link: UNLINKED }) } : version;
|
|
974
992
|
};
|
|
975
993
|
|
|
976
994
|
// core/check/project-command.ts
|
|
@@ -1003,7 +1021,11 @@ var repoRootOf = (request) => {
|
|
|
1003
1021
|
const selection = request.path.join({ segments: [resolved.value, SELECTION_FILE_NAME] });
|
|
1004
1022
|
return request.fileText.exists({ path: selection }) === "absent" ? { outcome: "failed", error: { kind: "selection-absent", repo: request.repo } } : resolved;
|
|
1005
1023
|
};
|
|
1006
|
-
var
|
|
1024
|
+
var installLinkOf = (request) => request.installRoot.outcome === "failed" ? UNLINKED : packageLinkOf({ ...request, installRoot: request.installRoot.value });
|
|
1025
|
+
var withShownPaths = (request) => request.run.outcome === "failed" ? {
|
|
1026
|
+
outcome: "failed",
|
|
1027
|
+
error: shownFailureOf({ failure: request.run.error, path: request.path, repoRoot: request.repoRoot, link: installLinkOf(request) })
|
|
1028
|
+
} : request.run;
|
|
1007
1029
|
var printOutcome = (request) => {
|
|
1008
1030
|
request.process.writeOut({ text: request.outcome.text });
|
|
1009
1031
|
request.process.exitWith({ code: request.outcome.code });
|
|
@@ -1013,10 +1035,6 @@ var checkRunOf = (request) => request.report.outcome === "failed" ? request.repo
|
|
|
1013
1035
|
value: { report: request.report.value, output: request.output, projectCommand: request.projectCommand }
|
|
1014
1036
|
};
|
|
1015
1037
|
var checkRunIn = async (request) => {
|
|
1016
|
-
const installRoot = installRootOf({ path: request.path, moduleUrl: request.moduleUrl });
|
|
1017
|
-
if (installRoot.outcome === "failed") {
|
|
1018
|
-
return installRoot;
|
|
1019
|
-
}
|
|
1020
1038
|
const projectCommand = projectCommandOf({ path: request.path, moduleUrl: request.moduleUrl, repoRoot: request.repoRoot });
|
|
1021
1039
|
if (projectCommand.outcome === "failed") {
|
|
1022
1040
|
return projectCommand;
|
|
@@ -1031,7 +1049,7 @@ var checkRunIn = async (request) => {
|
|
|
1031
1049
|
});
|
|
1032
1050
|
const report = await runCheck({
|
|
1033
1051
|
repoRoot: request.repoRoot,
|
|
1034
|
-
installRoot: installRoot
|
|
1052
|
+
installRoot: request.installRoot,
|
|
1035
1053
|
moduleExtension: moduleExtensionOf({ moduleUrl: request.moduleUrl }),
|
|
1036
1054
|
baseRevision: request.arguments.baseRevision,
|
|
1037
1055
|
assessment,
|
|
@@ -1055,10 +1073,13 @@ var checkRunFor = async (request) => {
|
|
|
1055
1073
|
if (repoRoot.outcome === "failed") {
|
|
1056
1074
|
return repoRoot;
|
|
1057
1075
|
}
|
|
1076
|
+
const installRoot = installRootOf({ path: request.path, moduleUrl: request.moduleUrl });
|
|
1058
1077
|
return withShownPaths({
|
|
1059
1078
|
path: request.path,
|
|
1079
|
+
fileText: request.fileText,
|
|
1060
1080
|
repoRoot: repoRoot.value,
|
|
1061
|
-
|
|
1081
|
+
installRoot,
|
|
1082
|
+
run: installRoot.outcome === "failed" ? installRoot : await checkRunIn({ ...request, arguments: parsed.value, repoRoot: repoRoot.value, installRoot: installRoot.value })
|
|
1062
1083
|
});
|
|
1063
1084
|
};
|
|
1064
1085
|
var runCheckCommand = (request) => checkRunFor(request).then(
|
|
@@ -1101,13 +1122,12 @@ var runProject = async (request) => {
|
|
|
1101
1122
|
|
|
1102
1123
|
// core/check/run-project-command.ts
|
|
1103
1124
|
var projectionsIn = (request) => {
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
return Promise.resolve(installRoot);
|
|
1125
|
+
if (request.installRoot.outcome === "failed") {
|
|
1126
|
+
return Promise.resolve(request.installRoot);
|
|
1107
1127
|
}
|
|
1108
1128
|
return runProject({
|
|
1109
1129
|
repoRoot: request.repoRoot,
|
|
1110
|
-
installRoot: installRoot.value,
|
|
1130
|
+
installRoot: request.installRoot.value,
|
|
1111
1131
|
moduleExtension: moduleExtensionOf({ moduleUrl: request.moduleUrl }),
|
|
1112
1132
|
fileText: request.fileText,
|
|
1113
1133
|
modules: request.modules,
|
|
@@ -1124,8 +1144,9 @@ var projectResult = (request) => {
|
|
|
1124
1144
|
if (repoRoot.outcome === "failed") {
|
|
1125
1145
|
return Promise.resolve(repoRoot);
|
|
1126
1146
|
}
|
|
1127
|
-
|
|
1128
|
-
|
|
1147
|
+
const installRoot = installRootOf({ path: request.path, moduleUrl: request.moduleUrl });
|
|
1148
|
+
return projectionsIn({ ...request, repoRoot: repoRoot.value, installRoot }).then(
|
|
1149
|
+
(run) => withShownPaths({ path: request.path, fileText: request.fileText, repoRoot: repoRoot.value, installRoot, run })
|
|
1129
1150
|
);
|
|
1130
1151
|
};
|
|
1131
1152
|
var runProjectCommand = (request) => projectResult(request).then(
|
package/docs/extending.md
CHANGED
|
@@ -218,6 +218,8 @@ export const check: WalkerPiece = {
|
|
|
218
218
|
- `prepare` runs once with the selected clauses, the repository's file list and TypeScript's syntax API. `prepareFile` runs once per tracked file and returns `skipped`, `complete` with its hits, or `syntax` with observers that walk the file's syntax tree. `finish` returns hits that need the whole repository.
|
|
219
219
|
- A hit passes back the clause's `address` unchanged, a 1-based line and 0-based column, and a short snippet.
|
|
220
220
|
- When the piece cannot run, for example on settings it does not accept, return a failed result whose error is a `PieceFailure`: `kind` `piece-invalid`, the clause's `pieceRoot` and a `detail`. `hone check` then stops with a load failure naming the piece folder.
|
|
221
|
+
- When the piece cannot parse a file, return a failed result whose error is `kind` `file-unparseable`, the `file` and a `detail`. `hone check` then stops with `load failure: runner-failed audit file-unparseable <file> <detail>`.
|
|
222
|
+
- To read JSON with comments, such as a `tsconfig.json`, call TypeScript's own parser on the syntax API: `syntaxApi.parseConfigFileTextToJson(file, text)` returns the parsed value as `config` and sets `error` when it cannot parse the text. A piece does not import a JSON parser of its own; see [What is stable](#what-is-stable).
|
|
221
223
|
|
|
222
224
|
### Settings a repository can change
|
|
223
225
|
|
package/docs/output-contract.md
CHANGED
|
@@ -10,8 +10,8 @@ Hone prints everything to standard output: the report, the help, the version, `h
|
|
|
10
10
|
|
|
11
11
|
The exit code is the signal a hook should act on:
|
|
12
12
|
|
|
13
|
-
- `0`: `hone check` printed `verdict: pass`, `hone project` wrote or confirmed every projection, or help or the version was printed;
|
|
14
|
-
- `1`: `hone check` printed `verdict: fail` as its last line. Exit `1` always comes with
|
|
13
|
+
- `0`: `hone check` printed `verdict: pass` or `verdict: pass (partial assessment)`, `hone project` wrote or confirmed every projection, or help or the version was printed;
|
|
14
|
+
- `1`: `hone check` printed `verdict: fail` or `verdict: fail (partial assessment)` as its last line. Exit `1` always comes with one of those lines, and with nothing else;
|
|
15
15
|
- `2`: Hone could not decide. It printed exactly one line, starting with `load failure: `, and no verdict. That covers a command typed wrongly, an input that could not be loaded, a mechanism that failed, and an error Hone did not expect, which prints as `unexpected-error`.
|
|
16
16
|
|
|
17
17
|
A 1.0 hook can rely on this: run `hone check`, block on any non-zero exit, and show standard output as it came.
|
|
@@ -62,7 +62,7 @@ In the tables below, a word in angle brackets, such as `<clause>`, stands for a
|
|
|
62
62
|
| `<comment>`, `<script>`, `<option>`, `<source>` | the native exception's comment, the `package.json` script name and the option in it, or where an imported record came from | may hold a space |
|
|
63
63
|
| `<detail>`, `<given>`, `<values>`, `<rule set>`, `<other rule set>`, `<clause with its rule set>`, `<version found>`, `<other package>`, `<range>` | text from the input, a tool or the command as typed | may hold a space |
|
|
64
64
|
|
|
65
|
-
Paths are printed with forward slashes. A path inside the `--repo` folder is printed relative to it, in the report and in load failures alike. A path outside it is printed absolute, such as `C:/Users/me/shared/rule.json` on Windows. A load failure from before `--repo` is resolved names the folder as typed (`<dir>`). A load failure reading the installed package's own `package.json`, which only `hone --version` reads, prints its absolute path. A path inside a `<detail>` is printed however the tool that wrote the detail printed it.
|
|
65
|
+
Paths are printed with forward slashes. A path inside the `--repo` folder is printed relative to it, in the report and in load failures alike. A path outside it is printed absolute, such as `C:/Users/me/shared/rule.json` on Windows. A load failure from before `--repo` is resolved names the folder as typed (`<dir>`). A path into Hone's own package, such as a `<rule page>`, the `<adoption guide>`, a `<piece folder>` or the `<install folder>`, is printed through the repository's `node_modules/@hailstails/hone` when that folder holds the same `package.json` as the package that is running, as it does under pnpm, which runs the package from its store under `node_modules/.pnpm`. When the repository root has no such folder, as when the package is installed only in a workspace package, installed globally or run from a source checkout, the path is printed where the running package is, by the rules above. A load failure reading the installed package's own `package.json`, which only `hone --version` reads, prints its absolute path. A path inside a `<detail>` is printed however the tool that wrote the detail printed it.
|
|
66
66
|
|
|
67
67
|
## Commands
|
|
68
68
|
|
|
@@ -73,7 +73,7 @@ hone --help
|
|
|
73
73
|
hone --version
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
-
Each option is followed by its value as the next argument; a value that starts with `-` is read as a missing value. `--help` or `-h` after a command prints that command's help instead of running it, and `hone --help <command>` prints the same. `hone --help` and `hone --version` take nothing else after them.
|
|
76
|
+
Each option is followed by its value as the next argument; a value that starts with `-` is read as a missing value. A bare `--` where an option is expected is skipped and the options after it are still read, so `pnpm run <script> -- <options>` works whether or not the package manager passes the `--` on; a `--` where a value is expected is a missing value, like any value that starts with `-`. `--help` or `-h` after a command prints that command's help instead of running it, and `hone --help <command>` prints the same. `hone --help` and `hone --version` take nothing else after them.
|
|
77
77
|
|
|
78
78
|
`hone --help` prints:
|
|
79
79
|
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
stringListClauseSettings
|
|
3
|
-
} from "../../../chunks/chunk-
|
|
3
|
+
} from "../../../chunks/chunk-YL6WR3QW.js";
|
|
4
4
|
import {
|
|
5
5
|
gatheredOutcomes
|
|
6
6
|
} from "../../../chunks/chunk-LDQUT742.js";
|
|
7
|
-
import "../../../chunks/chunk-
|
|
7
|
+
import "../../../chunks/chunk-5X2BR42Y.js";
|
|
8
8
|
import {
|
|
9
9
|
folderScope
|
|
10
10
|
} from "../../../chunks/chunk-QWA6OVLC.js";
|
|
11
|
-
import "../../../chunks/chunk-NZLE2WMY.js";
|
|
12
11
|
|
|
13
12
|
// mechanisms/audit/CD-19/import-boundaries.ts
|
|
14
13
|
var sourceEligibility = (request) => {
|
|
@@ -68,7 +67,7 @@ var check = {
|
|
|
68
67
|
const record = (specifier) => {
|
|
69
68
|
if (specifier === void 0 || !syntaxApi.isStringLiteralLike(specifier) || !specifier.text.startsWith("node:")) return;
|
|
70
69
|
const anchor = anchorAt({ position: specifier.getStart(sourceFile) });
|
|
71
|
-
const snippet = `bare node: stdlib import -
|
|
70
|
+
const snippet = `bare node: stdlib import - confined; only a wrapping file this repository records as an authorised location may import it: ${specifier.text}`;
|
|
72
71
|
nodeHits.push(...clauses.map((clause) => ({ clause: clause.address, anchor, snippet })));
|
|
73
72
|
};
|
|
74
73
|
return {
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
folderScope
|
|
9
9
|
} from "../../../chunks/chunk-QWA6OVLC.js";
|
|
10
|
-
import "../../../chunks/chunk-NZLE2WMY.js";
|
|
11
10
|
|
|
12
11
|
// mechanisms/audit/CD-2/cast-expressions.ts
|
|
13
12
|
var THROUGH_UNKNOWN_MESSAGE = "cast through unknown \u2014 check the value's shape at runtime instead";
|